mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-07 20:54:32 +00:00
Update Semantic test copyrights, delete some test files (Bug#4656).
* cedet/tests/test.cpp: * cedet/tests/test.py: * cedet/tests/teststruct.cpp: * cedet/tests/testtemplates.cpp: * cedet/tests/testusing.cpp: * cedet/tests/scopetest.cpp: * cedet/tests/scopetest.java: Files deleted. * cedet/tests/test.make: * cedet/tests/test.c: * cedet/tests/testjavacomp.java: * cedet/tests/testspp.c: * cedet/tests/testsppreplace.c: * cedet/tests/testsppreplaced.c: * cedet/tests/testsubclass.cpp: * cedet/tests/testsubclass.hh: * cedet/tests/testtypedefs.cpp: * cedet/tests/testvarnames.c: * cedet/tests/test.el: * cedet/tests/testdoublens.cpp: * cedet/tests/testdoublens.hpp: Add copyright header. * cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove reference to deleted files.
This commit is contained in:
parent
fe59d70512
commit
a4100ebe29
@ -1,3 +1,30 @@
|
||||
2010-03-29 Chong Yidong <cyd@stupidchicken.com>
|
||||
|
||||
* cedet/tests/test.cpp:
|
||||
* cedet/tests/test.py:
|
||||
* cedet/tests/teststruct.cpp:
|
||||
* cedet/tests/testtemplates.cpp:
|
||||
* cedet/tests/testusing.cpp:
|
||||
* cedet/tests/scopetest.cpp:
|
||||
* cedet/tests/scopetest.java: Files deleted.
|
||||
|
||||
* cedet/tests/test.make:
|
||||
* cedet/tests/test.c:
|
||||
* cedet/tests/testjavacomp.java:
|
||||
* cedet/tests/testspp.c:
|
||||
* cedet/tests/testsppreplace.c:
|
||||
* cedet/tests/testsppreplaced.c:
|
||||
* cedet/tests/testsubclass.cpp:
|
||||
* cedet/tests/testsubclass.hh:
|
||||
* cedet/tests/testtypedefs.cpp:
|
||||
* cedet/tests/testvarnames.c:
|
||||
* cedet/tests/test.el:
|
||||
* cedet/tests/testdoublens.cpp:
|
||||
* cedet/tests/testdoublens.hpp: Add copyright header.
|
||||
|
||||
* cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove
|
||||
reference to deleted files.
|
||||
|
||||
2010-02-19 Ulf Jasper <ulf.jasper@web.de>
|
||||
|
||||
* icalendar-testsuite.el
|
||||
|
@ -42,10 +42,7 @@
|
||||
"tests/testdoublens.cpp"
|
||||
"tests/testsubclass.cpp"
|
||||
"tests/testtypedefs.cpp"
|
||||
"tests/teststruct.cpp"
|
||||
"tests/testtemplates.cpp"
|
||||
"tests/testfriends.cpp"
|
||||
"tests/testusing.cpp"
|
||||
"tests/testnsp.cpp"
|
||||
"tests/testsppcomplete.c"
|
||||
"tests/testvarnames.c"
|
||||
|
@ -107,53 +107,6 @@ If optional arg STANDARDFILE is non-nil, use a standard file w/ global enabled."
|
||||
(data-debug-new-buffer "*SemanticDB Gnu Global Result*")
|
||||
(data-debug-insert-thing result "?" ""))))
|
||||
|
||||
;;; From semantic-find
|
||||
|
||||
(require 'semantic/find)
|
||||
|
||||
(defun semantic-find-benchmark ()
|
||||
"Run some simple benchmarks to see how we are doing.
|
||||
Optional argument ARG is the number of iterations to run."
|
||||
(interactive)
|
||||
(require 'benchmark)
|
||||
(let ((f-name nil)
|
||||
(b-name nil)
|
||||
(f-comp)
|
||||
(b-comp)
|
||||
(f-regex)
|
||||
)
|
||||
(garbage-collect)
|
||||
(setq f-name
|
||||
(benchmark-run-compiled
|
||||
1000 (semantic-find-first-tag-by-name "class3"
|
||||
"test/test.cpp")))
|
||||
(garbage-collect)
|
||||
(setq b-name
|
||||
(benchmark-run-compiled
|
||||
1000 (semantic-brute-find-first-tag-by-name "class3"
|
||||
"test/test.cpp")))
|
||||
(garbage-collect)
|
||||
(setq f-comp
|
||||
(benchmark-run-compiled
|
||||
1000 (semantic-find-tags-for-completion "method"
|
||||
"test/test.cpp")))
|
||||
(garbage-collect)
|
||||
(setq b-comp
|
||||
(benchmark-run-compiled
|
||||
1000 (semantic-brute-find-tag-by-name-regexp "^method"
|
||||
"test/test.cpp")))
|
||||
(garbage-collect)
|
||||
(setq f-regex
|
||||
(benchmark-run-compiled
|
||||
1000 (semantic-find-tags-by-name-regexp "^method"
|
||||
"test/test.cpp")))
|
||||
|
||||
(message "Name [new old] [ %.3f %.3f ] Complete [newc/new old] [ %.3f/%.3f %.3f ]"
|
||||
(car f-name) (car b-name)
|
||||
(car f-comp) (car f-regex)
|
||||
(car b-comp))
|
||||
))
|
||||
|
||||
;;; From semantic-format
|
||||
|
||||
(require 'semantic/format)
|
||||
|
@ -1,48 +0,0 @@
|
||||
/* Test scoping rules for c++ in the analyzer. */
|
||||
|
||||
namespace {
|
||||
|
||||
class aclass2; // Forward reference.
|
||||
|
||||
class aclass1 {
|
||||
private:
|
||||
int attrp1;
|
||||
int amethodp1(int argp1);
|
||||
aclass2 areference;
|
||||
protected:
|
||||
int attrpr1;
|
||||
public:
|
||||
int attr1;
|
||||
int amethod1(int arg1);
|
||||
};
|
||||
}
|
||||
|
||||
namespace {
|
||||
class aclass2 : public aclass1
|
||||
{
|
||||
private:
|
||||
int attrp2;
|
||||
int amethodp2(int argp1);
|
||||
public:
|
||||
aclass2(int aninitvalue);
|
||||
~aclass2();
|
||||
int attr2;
|
||||
int amethod2(int arg2);
|
||||
};
|
||||
}
|
||||
|
||||
aclass2::aclass2(init aninitvalue)
|
||||
{
|
||||
/* This is a comment that talks about aclass1 */
|
||||
aclass1;
|
||||
}
|
||||
|
||||
int aclass2::amethod2(int arg2)
|
||||
{
|
||||
int alocalvar;
|
||||
float q;
|
||||
|
||||
ac;
|
||||
}
|
||||
|
||||
// arch-tag: 9336063c-6b2e-4677-a390-d2dd091a2474
|
@ -1,25 +0,0 @@
|
||||
class Foo {
|
||||
|
||||
public void a1() {}
|
||||
|
||||
class Bar {
|
||||
|
||||
public int a2() {}
|
||||
|
||||
public void b() {
|
||||
a // -1-
|
||||
}
|
||||
|
||||
class Baz {
|
||||
|
||||
public int a3() {}
|
||||
|
||||
public Baz(int a4) {
|
||||
a // -2-
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
// C++ examples and requests from Klaus Berndl
|
||||
|
||||
// template in a unnamed namespace
|
||||
namespace
|
||||
{
|
||||
template<typename Target, typename Source>
|
||||
Target lexical_cast(Source arg)
|
||||
{
|
||||
std::stringstream interpreter;
|
||||
Target result;
|
||||
|
||||
if(!(interpreter << arg) || !(interpreter >> result) ||
|
||||
!(interpreter >> std::ws).eof())
|
||||
throw bad_lexical_cast();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T, FOO> class Vector
|
||||
{
|
||||
private:
|
||||
static T* v;
|
||||
int sz;
|
||||
|
||||
public:
|
||||
T& elem(int i) {return v[i];}
|
||||
virtual ~Vector ();
|
||||
|
||||
protected:
|
||||
Vector ();
|
||||
};
|
||||
|
||||
template <> class Vector <void*>
|
||||
{
|
||||
private:
|
||||
void** v;
|
||||
int sz;
|
||||
|
||||
public:
|
||||
Vector ();
|
||||
virtual int func1(int i);
|
||||
virtual int func2(int i) = 0;
|
||||
static virtual int func3(int i) = 0;
|
||||
void*& elem(int i) {return v[i];}
|
||||
//...
|
||||
};
|
||||
|
||||
// template contains namespace
|
||||
typedef vector<CzkUtilities::Action*> ActionList;
|
||||
|
||||
// declaration of some template-types
|
||||
map<XXX, Test::YYY>** map_var;
|
||||
|
||||
map_with_size<XXX, Test::YYY, size> map_size_var;
|
||||
typedef map_with_size<XXX, Test::YYY, size> SizedMap;
|
||||
|
||||
map_with_10_size<XXX, Test::YYY, 10>* pMap_size10_var;
|
||||
typedef map_with_10_size<XXX, Test::YYY, 10> Size10Map;
|
||||
|
||||
// a function which such a template-argument
|
||||
void* test_function(map<ClassX, Test::ClassY, 10>* pMap);
|
||||
|
||||
|
||||
template <class T> class Vector <T*> : private Vector <void*>
|
||||
{
|
||||
public:
|
||||
typedef Vector <void*> Base;
|
||||
|
||||
Vector () : Base() {}
|
||||
|
||||
T*& elem(int i) {return static_cast<T*&>(Base::elem(i));}
|
||||
//...
|
||||
};
|
||||
|
||||
// outside method implementation of a template-class
|
||||
template<class T> T& Vector<T*>::elem(int i)
|
||||
{
|
||||
return C;
|
||||
}
|
||||
|
||||
// same but qualified with a namespace Testnamespace
|
||||
template<class T> T& Testnamespace::Vector<T*>::elem(int i)
|
||||
{
|
||||
return C;
|
||||
}
|
||||
|
||||
// function templates with keyword typename
|
||||
template<typename Target, typename Source>
|
||||
Target lexical_cast(Source arg)
|
||||
{
|
||||
std::stringstream interpreter;
|
||||
Target result;
|
||||
|
||||
if(!(interpreter << arg) || !(interpreter >> result) ||
|
||||
!(interpreter >> std::ws).eof())
|
||||
throw bad_lexical_cast();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static
|
||||
typename T::_ptr_type
|
||||
getService(const std::string& pServiceName, const int pRetries=20)
|
||||
{
|
||||
return T::_narrow(getServiceObject(pServiceName, pRetries));
|
||||
}
|
||||
|
||||
// function template declaration
|
||||
template<class T> void sort(vector<T>&);
|
||||
// complex function template definition
|
||||
template<class T, class S, const NamespaceY::ClassX<TestClass, &s> volatile ***&i>
|
||||
map<ClassY, ClassX, 10>
|
||||
sort(const vector<T>& v)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// variable declarations of template-types
|
||||
foo<TClass, Testnamespace::XClass, i> *bar1;
|
||||
foo<TClass, Testnamespace::XClass, **&i> *bar2;
|
||||
foo<TClass, Testnamespace::XClass, *Namespace::ClassX::i> bar3;
|
||||
foo<0> bar0;
|
||||
|
||||
class SomeName;
|
||||
class OtherName;
|
||||
|
||||
// arch-tag: 55ff74de-74dc-44ad-8252-50dc5f3492c3
|
@ -1,6 +1,29 @@
|
||||
/* Test file for C language.
|
||||
* Attempt to include as many aspects of the C language as possible.
|
||||
/* test.c --- Semantic unit test for C.
|
||||
|
||||
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
2010 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Attempt to include as many aspects of the C language as possible.
|
||||
*/
|
||||
|
||||
/* types of include files */
|
||||
#include "includeme1.h"
|
||||
#include <includeme2.h>
|
||||
|
@ -1,592 +0,0 @@
|
||||
/* Test file for C++ language.
|
||||
* Attempt to include as many aspects of the C++ language as possible.
|
||||
* Do not include things tested in test.c since that shares the
|
||||
* same language.
|
||||
*/
|
||||
|
||||
/* An include test */
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "c++-test.hh"
|
||||
|
||||
#include <c++-test.hh>
|
||||
|
||||
double var1 = 1.2;
|
||||
|
||||
int simple1(int a) {
|
||||
|
||||
}
|
||||
|
||||
struct foo1 {
|
||||
int test;
|
||||
};
|
||||
|
||||
struct foo2 : public foo1 {
|
||||
const int foo21(int a, int b);
|
||||
const int foo22(int a, int b) { return 1 }
|
||||
};
|
||||
|
||||
/* Classes */
|
||||
class class1 {
|
||||
private:
|
||||
int var11;
|
||||
struct foo1 var12;
|
||||
public:
|
||||
int p_var11;
|
||||
struct foo p_var12;
|
||||
};
|
||||
|
||||
class i_class1 : public class1 {
|
||||
private:
|
||||
int var11;
|
||||
struct foo var12;
|
||||
public:
|
||||
int p_var11;
|
||||
struct foo p_var12;
|
||||
};
|
||||
|
||||
class class2 {
|
||||
private:
|
||||
int var21;
|
||||
struct foo var22;
|
||||
public:
|
||||
int p_var21;
|
||||
struct foo p_var22;
|
||||
};
|
||||
|
||||
class i_class2 : public class1, public class2 {
|
||||
private:
|
||||
int var21;
|
||||
struct foo var22;
|
||||
protected:
|
||||
int pt_var21;
|
||||
public:
|
||||
int p_var21;
|
||||
struct foo p_var22;
|
||||
};
|
||||
|
||||
class class3 {
|
||||
/* A class with strange things in it */
|
||||
public:
|
||||
class3(); /* A constructor */
|
||||
enum embedded_foo_enum {
|
||||
a, b, c
|
||||
} embed1;
|
||||
struct embedded_bar_struct {
|
||||
int a;
|
||||
int b;
|
||||
} embed2;
|
||||
class embedded_baz_class {
|
||||
embedded_baz_class();
|
||||
~embedded_baz_class();
|
||||
} embed3;
|
||||
~class3(); /* destructor */
|
||||
|
||||
/* Methods */
|
||||
int method_for_class3(int a, char b);
|
||||
|
||||
int inline_method(int c) { return c; }
|
||||
|
||||
/* Operators */
|
||||
class3& operator^= (const class3& something);
|
||||
|
||||
/* Funny declmods */
|
||||
const class3 * const method_const_ptr_ptr(const int * const argconst) const = 0;
|
||||
};
|
||||
|
||||
class3::class3()
|
||||
{
|
||||
/* Constructor outside the definition. */
|
||||
}
|
||||
|
||||
int class3::method_for_class3(int a, char b)
|
||||
{
|
||||
}
|
||||
|
||||
int class3::method1_for_class3( int a, int &b)
|
||||
{
|
||||
int cvariablename;
|
||||
class3 fooy[];
|
||||
class3 moose = new class3;
|
||||
|
||||
// Complktion testing line should find external members.
|
||||
a = fooy[1].me ;
|
||||
b = cv ;
|
||||
|
||||
if (fooy.emb) {
|
||||
simple1(c);
|
||||
}
|
||||
|
||||
cos(10);
|
||||
abs(10);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
char class3::method2_for_class3( int a, int b) throw ( exception1 )
|
||||
{
|
||||
return 'a';
|
||||
}
|
||||
|
||||
void *class3::method3_for_class3( int a, int b) throw ( exception1, exception2 )
|
||||
{
|
||||
int q = a;
|
||||
return "Moose";
|
||||
}
|
||||
|
||||
void *class3::method31_for_class3( int a, int b) throw ( )
|
||||
{
|
||||
int q = a;
|
||||
return "Moose";
|
||||
}
|
||||
|
||||
void *class3::method4_for_class3( int a, int b) reentrant
|
||||
{
|
||||
class3 ct;
|
||||
|
||||
ct.method5_for_class3(1,a);
|
||||
|
||||
pritf();
|
||||
}
|
||||
|
||||
/*
|
||||
* A method on class3.
|
||||
*/
|
||||
void *class3::method5_for_class3( int a, int b) const
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Namespace parsing tests
|
||||
*/
|
||||
namespace NS {
|
||||
class class_in_namespace {
|
||||
int equiv(const NS::class_in_namespace *) const;
|
||||
};
|
||||
}
|
||||
|
||||
int NS::class_in_namespace::equiv(const NS::class_in_namespace *cin) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Stuff Klaus found.
|
||||
// Inheritance w/out a specifying for public.
|
||||
class class4 : class1 {
|
||||
// Pure virtual methods.
|
||||
void virtual print () const = 0;
|
||||
|
||||
public:
|
||||
// The whacky constructor type
|
||||
class4()
|
||||
try : class1(args)
|
||||
{
|
||||
// constructor body
|
||||
}
|
||||
catch ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
class class5 : public virtual class4 {
|
||||
// Virtual inheritance
|
||||
};
|
||||
|
||||
class class6 : class1 {
|
||||
// Mutable
|
||||
mutable int i;
|
||||
};
|
||||
|
||||
/* Namespaces */
|
||||
namespace namespace1 {
|
||||
void ns_method1() { }
|
||||
|
||||
class n_class1 {
|
||||
public:
|
||||
void method11(int a) { }
|
||||
};
|
||||
|
||||
/* This shouldn't parse due to missing semicolon. */
|
||||
class _n_class2 : public n_class1 {
|
||||
void n_c2_method1(int a, int b) { }
|
||||
};
|
||||
|
||||
// Macros in the namespace
|
||||
#define NSMACRO 1
|
||||
|
||||
// Template in the namespace
|
||||
template<class T> T nsti1(const Foo& foo);
|
||||
template<> int nsti1<int>(const Foo& foo);
|
||||
|
||||
}
|
||||
|
||||
namespace namespace2 {
|
||||
|
||||
using namespace1::n_class1;
|
||||
|
||||
}
|
||||
|
||||
/* Initializers */
|
||||
void tinitializers1(): inita1(False),
|
||||
inita2(False)
|
||||
{
|
||||
inita1= 1;
|
||||
}
|
||||
|
||||
/* How about Extern C type things. */
|
||||
int funny_prototype(int ,int b,float c)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int extern_c_1(int a, int b)
|
||||
{
|
||||
|
||||
funny_prototype(1,2,3.4);
|
||||
|
||||
printf("Moose", );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
int extern_c_2(int a, int b)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Some operator stuff
|
||||
class Action
|
||||
{
|
||||
// Problems!! operator() and operator[] can not be parsed with semantic
|
||||
// 1.4.2 but with latest c.by
|
||||
virtual void operator()(int i, char *p ) = 0;
|
||||
virtual String& operator[]() = 0;
|
||||
virtual void operator!() = 0;
|
||||
virtual void operator->() = 0;
|
||||
virtual T& operator+=();
|
||||
virtual T& operator*();
|
||||
virtual T& operator*=();
|
||||
};
|
||||
|
||||
// class with namespace qualified parents
|
||||
class Multiinherit : public virtual POA::Parent,
|
||||
public virtual POA::Parent1,
|
||||
Parent
|
||||
{
|
||||
private:
|
||||
int i;
|
||||
|
||||
public:
|
||||
Multiinherit();
|
||||
~Multiinherit();
|
||||
|
||||
// method with a list of qualified exceptions
|
||||
void* throwtest()
|
||||
throw(Exception0,
|
||||
Testnamespace::Exception1,
|
||||
Testnamespace::Excpetion2,
|
||||
Testnamespace::testnamespace1::Exception3);
|
||||
|
||||
};
|
||||
|
||||
void*
|
||||
Multiinherit::throwtest()
|
||||
throw (Exception0,
|
||||
Testnamespace::Exception1,
|
||||
Testnamespace::Excpetion2,
|
||||
Testnamespace::testnamespace1::Exception3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Jens Rock <jens.rock@asamnet.de>: Nested classes or structs defined
|
||||
// outside of the containing class/struct.
|
||||
class container
|
||||
{
|
||||
public:
|
||||
struct contained;
|
||||
container();
|
||||
~container();
|
||||
};
|
||||
|
||||
struct container::contained
|
||||
{
|
||||
public:
|
||||
contained();
|
||||
~contained();
|
||||
};
|
||||
|
||||
/*
|
||||
* Ok, how about some template stuff.
|
||||
*/
|
||||
template <class CT, class container = vector<CT> >
|
||||
const CT& max (const CT& a, const CT& b)
|
||||
{
|
||||
return a < b ? b : a;
|
||||
}
|
||||
|
||||
// Arne Schmitz found this one
|
||||
std::vector<int> &a, &b, &c;
|
||||
|
||||
class TemplateUsingClass
|
||||
{
|
||||
typedef TestClassMap::iterator iterator;
|
||||
typedef map<long, long> TestClassMap;
|
||||
|
||||
// typedefs with const and volatile
|
||||
typedef const map<long, long> const_TestClassMap;
|
||||
typedef TestClassMap<string>::iterator volatile volatile_iterator;
|
||||
|
||||
map<int, int> mapclassvarthingy;
|
||||
};
|
||||
|
||||
template<class T> T ti1(const Foo& foo);
|
||||
template<> int ti1<int>(const Foo& foo);
|
||||
|
||||
|
||||
// -----------------------------------
|
||||
// Now some namespace and related stuff
|
||||
// -----------------------------------
|
||||
|
||||
using CORBA::LEX::get_token;
|
||||
using Namespace1;
|
||||
|
||||
using namespace POA::std;
|
||||
using namespace Test;
|
||||
|
||||
|
||||
|
||||
namespace Parser
|
||||
{
|
||||
namespace
|
||||
{
|
||||
using Lexer::get_test;
|
||||
string str = "";
|
||||
}
|
||||
|
||||
namespace XXX
|
||||
{
|
||||
|
||||
class Foobar : public virtual POA::Parent,
|
||||
public virtual POA::Parent1,
|
||||
private POA::list<fact>,
|
||||
private map<string>
|
||||
{
|
||||
ini i;
|
||||
list <shared_ptr<item> >::const_iterator l;
|
||||
public:
|
||||
|
||||
Foobar();
|
||||
~Foobar();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void test_function(int i);
|
||||
|
||||
};
|
||||
|
||||
// unnamed namespaces - even nested
|
||||
namespace
|
||||
{
|
||||
namespace
|
||||
{
|
||||
using Lexer::get_test;
|
||||
string str = "";
|
||||
}
|
||||
|
||||
// some builtin types
|
||||
long long ll = 0;
|
||||
long double d = 0.0;
|
||||
unsigned test;
|
||||
unsigned long int **uli = 0;
|
||||
signed si = 0;
|
||||
signed short ss = 0;
|
||||
short int i = 0;
|
||||
long int li = 0;
|
||||
|
||||
// expressions with namespace/class-qualifyiers
|
||||
ORB_var cGlobalOrb = ORB::_nil();
|
||||
ORB_var1 cGlobalOrb1 = ORB::_test;
|
||||
|
||||
class Testclass
|
||||
{
|
||||
#define TEST 0
|
||||
ini i;
|
||||
|
||||
public:
|
||||
|
||||
Testclass();
|
||||
~Testclass();
|
||||
};
|
||||
|
||||
static void test_function(unsigned int i);
|
||||
|
||||
};
|
||||
|
||||
|
||||
// outside method implementations which should be grouped to type Test
|
||||
XXX&
|
||||
Test::waiting()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
Test::print()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// outside method implementations with namespaces which should be grouped to
|
||||
// their complete (incl. namespace) types
|
||||
void*
|
||||
Parser::XXX::Foobar::wait(int i, const char const * const * p)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void*
|
||||
Namespace1::Test::wait1(int i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
Namespace1::Test::waiting(int i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// a class with some outside implementations which should all be grouped to
|
||||
// this class declaration
|
||||
class ClassWithExternals
|
||||
{
|
||||
private:
|
||||
int i;
|
||||
|
||||
public:
|
||||
ClassWithExternals();
|
||||
~ClassWithExternals();
|
||||
void non_nil();
|
||||
};
|
||||
|
||||
|
||||
// Foobar is not displayed; seems that semantic tries to add this to the class
|
||||
// Foobar but can not find/display it, because contained in the namespace above.
|
||||
void
|
||||
Foobar::non_nil()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// are correctly grouped to the ClassWithExternals class
|
||||
void
|
||||
ClassWithExternals::non_nil()
|
||||
{
|
||||
String s = "lödfjg dlfgkdlfkgjdl";
|
||||
return;
|
||||
}
|
||||
|
||||
ClassWithExternals::ClassWithExternals()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
ClassWithExternals::~ClassWithExternals()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------
|
||||
// Now some macro and define stuff
|
||||
// -------------------------------
|
||||
|
||||
#define TEST 0
|
||||
#define TEST1 "String"
|
||||
|
||||
// The first backslash makes this macro unmatched syntax with semantic 1.4.2!
|
||||
// With flexing \+newline as nothing all is working fine!
|
||||
#define MZK_ENTER(METHOD) \
|
||||
{ \
|
||||
CzkMethodLog lMethodLog(METHOD,"Framework");\
|
||||
}
|
||||
|
||||
#define ZK_ASSERTM(METHOD,ASSERTION,MESSAGE) \
|
||||
{ if(!(ASSERTION))\
|
||||
{\
|
||||
std::ostringstream lMesgStream; \
|
||||
lMesgStream << "Assertion failed: " \
|
||||
<< MESSAGE; \
|
||||
CzkLogManager::doLog(CzkLogManager::FATAL,"",METHOD, \
|
||||
"Assert",lMesgStream); \
|
||||
assert(ASSERTION);\
|
||||
}\
|
||||
}
|
||||
|
||||
// Test if not newline-backslashes are handled correctly
|
||||
string s = "My \"quoted\" string";
|
||||
|
||||
// parsed fine as macro
|
||||
#define FOO (arg) method(arg, "foo");
|
||||
|
||||
// With semantic 1.4.2 this parsed as macro BAR *and* function method.
|
||||
// With latest c.bnf at least one-liner macros can be parsed correctly.
|
||||
#define BAR (arg) CzkMessageLog method(arg, "bar");
|
||||
|
||||
// some const and volatile stuff
|
||||
char * p1 = "Hello"; // 1. variable Pointer, variable Data
|
||||
const char * p2 = "Hello"; // 2. variable pointer, constant data
|
||||
char * const p3 = "Hello"; // 3. constant pointer, variable data
|
||||
const char * const p4 = "Hello"; // 4. constant pointer, constant data
|
||||
|
||||
// Case 2 and 4 can exchange first "const" and "char"
|
||||
char const * p21 = "Hello"; // variable pointer, constant data
|
||||
char const * const p41 = "Hello"; // constant pointer, constant data
|
||||
|
||||
char volatile a = 0; // a volatile char
|
||||
void foo(bar const &arg); // a reference to a const bar
|
||||
int foobar(bar const * const p); // a const pointer to a const bar
|
||||
int foobar(bar const volatile * const p); // a const pointer to a const bar
|
||||
int foobar3(char* p); // a const pointer to a const bar
|
||||
|
||||
// Should not be parsed because this is invalid code
|
||||
int const & const r3 = i;
|
||||
|
||||
boolean i = 0;
|
||||
boolean & r1 = i;
|
||||
boolean const & r2 = i;
|
||||
|
||||
// const * sequences can be very long in C++ ;-)
|
||||
char const * const * const * const * ppp;
|
||||
|
||||
// complex function declarationen with named pointer-arguments
|
||||
const char** foobar1(volatile char const * const **p);
|
||||
const char** foobar11(volatile Test::Namespace::Char<char*> const * const **p);
|
||||
|
||||
// complex function declarationen with unnamed pointer-arguments
|
||||
const char* foobar2(const char***);
|
||||
const char* foobar21(const Test::Namespace::Char<char>***);
|
||||
|
||||
// string literal parsing even with wchar_t
|
||||
char const *p = "string1";
|
||||
char const *q = "string1" "str\"ing2" "string3";
|
||||
wchar_t testc = L'a';
|
||||
|
||||
wchar_t const *wp = L"string with a \" in it";
|
||||
wchar_t const *wq = L"string \n\t\"test" L"string2";
|
||||
wchar_t const *wr = L"string L";
|
||||
|
||||
// arch-tag: 59828880-d72f-4059-922f-89579edf9e58
|
@ -1,6 +1,24 @@
|
||||
;; Test file for Emacs Lisp.
|
||||
;; Attempt to include as many aspects of Emacs Lisp as possible.
|
||||
;;
|
||||
;;; test.el --- Unit test file for Semantic Emacs Lisp support.
|
||||
|
||||
;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010
|
||||
;; Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs 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 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Require
|
||||
;;
|
||||
@ -88,7 +106,7 @@
|
||||
(autoload (quote a-autoload) "somefile"
|
||||
"Non-interactive autoload." nil nil)
|
||||
|
||||
(autoload (quote a-autoload-interactive) "somefile"
|
||||
(autoload (quote a-autoload-interactive) "somefile"
|
||||
"Interactive autoload." t nil)
|
||||
|
||||
|
||||
@ -116,7 +134,7 @@
|
||||
(slot-1 :equal 'eq)
|
||||
slot-2)
|
||||
|
||||
(defstruct test-struct-2
|
||||
(defstruct test-struct-2
|
||||
slot-1
|
||||
slot-2)
|
||||
|
||||
|
@ -1,4 +1,23 @@
|
||||
# Test makefile -*- makefile -*-
|
||||
# test.make --- Semantic unit test for Make -*- makefile -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
|
||||
|
||||
# Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
# This file is part of GNU Emacs.
|
||||
|
||||
# GNU Emacs 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
top=
|
||||
ede_FILES=Project.ede Makefile
|
||||
|
@ -1,580 +0,0 @@
|
||||
# Test file for Python language.
|
||||
#
|
||||
|
||||
# Simle class compount statement with blank lines sprinkled.
|
||||
class Foo(Bar):
|
||||
|
||||
x = 1
|
||||
|
||||
y = 2
|
||||
|
||||
# Simple def statement with no argument
|
||||
def sss():
|
||||
i = 1
|
||||
|
||||
# Simple def statement with arguments
|
||||
def ttt(x,y,z):
|
||||
i = 1
|
||||
|
||||
import foo
|
||||
|
||||
for x in y:
|
||||
print x
|
||||
|
||||
while y > 0:
|
||||
y = y - 1
|
||||
|
||||
a=b=c=d=e=f=i=j=k=l=m=n=o=p=q=r=s=t=x=y=1
|
||||
|
||||
if x:
|
||||
x = 2
|
||||
y = 3
|
||||
|
||||
x = 2
|
||||
y = 3
|
||||
s and t
|
||||
q | r
|
||||
o ^ p
|
||||
m & n
|
||||
k << l
|
||||
z = 4
|
||||
i >> j
|
||||
e / f
|
||||
c * d
|
||||
a + b
|
||||
2 ** 5
|
||||
x
|
||||
s = "a" "b" "c"
|
||||
1
|
||||
|
||||
# implicit continuation lines, see
|
||||
# http://docs.python.org/ref/implicit-joining.html
|
||||
|
||||
a_list = [ 1, 2, 3,
|
||||
4, 5,
|
||||
6 ]
|
||||
|
||||
a_tuple = (1, 2, 3,
|
||||
|
||||
4, 5, 6)
|
||||
|
||||
a_hash = { 'a':1, "b":2,
|
||||
'c' : 3,
|
||||
"d" : 4 }
|
||||
|
||||
|
||||
def longarglist(a,
|
||||
b,
|
||||
c,
|
||||
d):
|
||||
a=1;
|
||||
b=1;
|
||||
c=1;
|
||||
d=1;
|
||||
|
||||
class longclasslist(xx.yyy,
|
||||
zz.aa):
|
||||
foo=1
|
||||
|
||||
|
||||
# wisent-python.wy chokes on this! -ryk 6/17/02
|
||||
|
||||
class HTTPServer(xxx.yyy):
|
||||
allow_reuse_address = 1 # Seems to make sense in testing environment
|
||||
def server_bind(self):
|
||||
SocketServer.TCPServer.server_bind(self)
|
||||
host, port = self.socket.getsockname()
|
||||
self.server_name = socket.getfqdn(host)
|
||||
self.server_port = port
|
||||
|
||||
|
||||
#########################################################################
|
||||
### /usr/lib/python2.2/BaseHTTPServer.py
|
||||
#########################################################################
|
||||
|
||||
"""HTTP server base class.
|
||||
|
||||
Note: the class in this module doesn't implement any HTTP request; see
|
||||
SimpleHTTPServer for simple implementations of GET, HEAD and POST
|
||||
(including CGI scripts).
|
||||
|
||||
Contents:
|
||||
|
||||
- BaseHTTPRequestHandler: HTTP request handler base class
|
||||
- test: test function
|
||||
|
||||
XXX To do:
|
||||
|
||||
- send server version
|
||||
- log requests even later (to capture byte count)
|
||||
- log user-agent header and other interesting goodies
|
||||
- send error log to separate file
|
||||
- are request names really case sensitive?
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# See also:
|
||||
#
|
||||
# HTTP Working Group T. Berners-Lee
|
||||
# INTERNET-DRAFT R. T. Fielding
|
||||
# <draft-ietf-http-v10-spec-00.txt> H. Frystyk Nielsen
|
||||
# Expires September 8, 1995 March 8, 1995
|
||||
#
|
||||
# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
|
||||
|
||||
|
||||
# Log files
|
||||
# ---------
|
||||
#
|
||||
# Here's a quote from the NCSA httpd docs about log file format.
|
||||
#
|
||||
# | The logfile format is as follows. Each line consists of:
|
||||
# |
|
||||
# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
|
||||
# |
|
||||
# | host: Either the DNS name or the IP number of the remote client
|
||||
# | rfc931: Any information returned by identd for this person,
|
||||
# | - otherwise.
|
||||
# | authuser: If user sent a userid for authentication, the user name,
|
||||
# | - otherwise.
|
||||
# | DD: Day
|
||||
# | Mon: Month (calendar name)
|
||||
# | YYYY: Year
|
||||
# | hh: hour (24-hour format, the machine's timezone)
|
||||
# | mm: minutes
|
||||
# | ss: seconds
|
||||
# | request: The first line of the HTTP request as sent by the client.
|
||||
# | ddd: the status code returned by the server, - if not available.
|
||||
# | bbbb: the total number of bytes sent,
|
||||
# | *not including the HTTP/1.0 header*, - if not available
|
||||
# |
|
||||
# | You can determine the name of the file accessed through request.
|
||||
#
|
||||
# (Actually, the latter is only true if you know the server configuration
|
||||
# at the time the request was made!)
|
||||
|
||||
|
||||
__version__ = "0.2"
|
||||
|
||||
__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
|
||||
|
||||
import sys
|
||||
import time
|
||||
import socket # For gethostbyaddr()
|
||||
import mimetools
|
||||
import SocketServer
|
||||
|
||||
# Default error message
|
||||
DEFAULT_ERROR_MESSAGE = """\
|
||||
<head>
|
||||
<title>Error response</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Error response</h1>
|
||||
<p>Error code %(code)d.
|
||||
<p>Message: %(message)s.
|
||||
<p>Error code explanation: %(code)s = %(explain)s.
|
||||
</body>
|
||||
"""
|
||||
|
||||
|
||||
class HTTPServer(SocketServer.TCPServer):
|
||||
|
||||
allow_reuse_address = 1 # Seems to make sense in testing environment
|
||||
|
||||
def server_bind(self):
|
||||
"""Override server_bind to store the server name."""
|
||||
SocketServer.TCPServer.server_bind(self)
|
||||
host, port = self.socket.getsockname()
|
||||
self.server_name = socket.getfqdn(host)
|
||||
self.server_port = port
|
||||
|
||||
|
||||
class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
|
||||
|
||||
"""HTTP request handler base class.
|
||||
|
||||
The following explanation of HTTP serves to guide you through the
|
||||
code as well as to expose any misunderstandings I may have about
|
||||
HTTP (so you don't need to read the code to figure out I'm wrong
|
||||
:-).
|
||||
|
||||
HTTP (HyperText Transfer Protocol) is an extensible protocol on
|
||||
top of a reliable stream transport (e.g. TCP/IP). The protocol
|
||||
recognizes three parts to a request:
|
||||
|
||||
1. One line identifying the request type and path
|
||||
2. An optional set of RFC-822-style headers
|
||||
3. An optional data part
|
||||
|
||||
The headers and data are separated by a blank line.
|
||||
|
||||
The first line of the request has the form
|
||||
|
||||
<command> <path> <version>
|
||||
|
||||
where <command> is a (case-sensitive) keyword such as GET or POST,
|
||||
<path> is a string containing path information for the request,
|
||||
and <version> should be the string "HTTP/1.0". <path> is encoded
|
||||
using the URL encoding scheme (using %xx to signify the ASCII
|
||||
character with hex code xx).
|
||||
|
||||
The protocol is vague about whether lines are separated by LF
|
||||
characters or by CRLF pairs -- for compatibility with the widest
|
||||
range of clients, both should be accepted. Similarly, whitespace
|
||||
in the request line should be treated sensibly (allowing multiple
|
||||
spaces between components and allowing trailing whitespace).
|
||||
|
||||
Similarly, for output, lines ought to be separated by CRLF pairs
|
||||
but most clients grok LF characters just fine.
|
||||
|
||||
If the first line of the request has the form
|
||||
|
||||
<command> <path>
|
||||
|
||||
(i.e. <version> is left out) then this is assumed to be an HTTP
|
||||
0.9 request; this form has no optional headers and data part and
|
||||
the reply consists of just the data.
|
||||
|
||||
The reply form of the HTTP 1.0 protocol again has three parts:
|
||||
|
||||
1. One line giving the response code
|
||||
2. An optional set of RFC-822-style headers
|
||||
3. The data
|
||||
|
||||
Again, the headers and data are separated by a blank line.
|
||||
|
||||
The response code line has the form
|
||||
|
||||
<version> <responsecode> <responsestring>
|
||||
|
||||
where <version> is the protocol version (always "HTTP/1.0"),
|
||||
<responsecode> is a 3-digit response code indicating success or
|
||||
failure of the request, and <responsestring> is an optional
|
||||
human-readable string explaining what the response code means.
|
||||
|
||||
This server parses the request and the headers, and then calls a
|
||||
function specific to the request type (<command>). Specifically,
|
||||
a request SPAM will be handled by a method do_SPAM(). If no
|
||||
such method exists the server sends an error response to the
|
||||
client. If it exists, it is called with no arguments:
|
||||
|
||||
do_SPAM()
|
||||
|
||||
Note that the request name is case sensitive (i.e. SPAM and spam
|
||||
are different requests).
|
||||
|
||||
The various request details are stored in instance variables:
|
||||
|
||||
- client_address is the client IP address in the form (host,
|
||||
port);
|
||||
|
||||
- command, path and version are the broken-down request line;
|
||||
|
||||
- headers is an instance of mimetools.Message (or a derived
|
||||
class) containing the header information;
|
||||
|
||||
- rfile is a file object open for reading positioned at the
|
||||
start of the optional input data part;
|
||||
|
||||
- wfile is a file object open for writing.
|
||||
|
||||
IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING!
|
||||
|
||||
The first thing to be written must be the response line. Then
|
||||
follow 0 or more header lines, then a blank line, and then the
|
||||
actual data (if any). The meaning of the header lines depends on
|
||||
the command executed by the server; in most cases, when data is
|
||||
returned, there should be at least one header line of the form
|
||||
|
||||
Content-type: <type>/<subtype>
|
||||
|
||||
where <type> and <subtype> should be registered MIME types,
|
||||
e.g. "text/html" or "text/plain".
|
||||
|
||||
"""
|
||||
|
||||
# The Python system version, truncated to its first component.
|
||||
sys_version = "Python/" + sys.version.split()[0]
|
||||
|
||||
# The server software version. You may want to override this.
|
||||
# The format is multiple whitespace-separated strings,
|
||||
# where each string is of the form name[/version].
|
||||
server_version = "BaseHTTP/" + __version__
|
||||
|
||||
def parse_request(self):
|
||||
"""Parse a request (internal).
|
||||
|
||||
The request should be stored in self.raw_request; the results
|
||||
are in self.command, self.path, self.request_version and
|
||||
self.headers.
|
||||
|
||||
Return value is 1 for success, 0 for failure; on failure, an
|
||||
error is sent back.
|
||||
|
||||
"""
|
||||
self.request_version = version = "HTTP/0.9" # Default
|
||||
requestline = self.raw_requestline
|
||||
if requestline[-2:] == '\r\n':
|
||||
requestline = requestline[:-2]
|
||||
elif requestline[-1:] == '\n':
|
||||
requestline = requestline[:-1]
|
||||
self.requestline = requestline
|
||||
words = requestline.split()
|
||||
if len(words) == 3:
|
||||
[command, path, version] = words
|
||||
if version[:5] != 'HTTP/':
|
||||
self.send_error(400, "Bad request version (%s)" % `version`)
|
||||
return 0
|
||||
elif len(words) == 2:
|
||||
[command, path] = words
|
||||
if command != 'GET':
|
||||
self.send_error(400,
|
||||
"Bad HTTP/0.9 request type (%s)" % `command`)
|
||||
return 0
|
||||
else:
|
||||
self.send_error(400, "Bad request syntax (%s)" % `requestline`)
|
||||
return 0
|
||||
self.command, self.path, self.request_version = command, path, version
|
||||
self.headers = self.MessageClass(self.rfile, 0)
|
||||
return 1
|
||||
|
||||
def handle(self):
|
||||
"""Handle a single HTTP request.
|
||||
|
||||
You normally don't need to override this method; see the class
|
||||
__doc__ string for information on how to handle specific HTTP
|
||||
commands such as GET and POST.
|
||||
|
||||
"""
|
||||
|
||||
self.raw_requestline = self.rfile.readline()
|
||||
if not self.parse_request(): # An error code has been sent, just exit
|
||||
return
|
||||
mname = 'do_' + self.command
|
||||
if not hasattr(self, mname):
|
||||
self.send_error(501, "Unsupported method (%s)" % `self.command`)
|
||||
return
|
||||
method = getattr(self, mname)
|
||||
method()
|
||||
|
||||
def send_error(self, code, message=None):
|
||||
"""Send and log an error reply.
|
||||
|
||||
Arguments are the error code, and a detailed message.
|
||||
The detailed message defaults to the short entry matching the
|
||||
response code.
|
||||
|
||||
This sends an error response (so it must be called before any
|
||||
output has been generated), logs the error, and finally sends
|
||||
a piece of HTML explaining the error to the user.
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
short, long = self.responses[code]
|
||||
except KeyError:
|
||||
short, long = '???', '???'
|
||||
if not message:
|
||||
message = short
|
||||
explain = long
|
||||
self.log_error("code %d, message %s", code, message)
|
||||
self.send_response(code, message)
|
||||
self.send_header("Content-Type", "text/html")
|
||||
self.end_headers()
|
||||
self.wfile.write(self.error_message_format %
|
||||
{'code': code,
|
||||
'message': message,
|
||||
'explain': explain})
|
||||
|
||||
error_message_format = DEFAULT_ERROR_MESSAGE
|
||||
|
||||
def send_response(self, code, message=None):
|
||||
"""Send the response header and log the response code.
|
||||
|
||||
Also send two standard headers with the server software
|
||||
version and the current date.
|
||||
|
||||
"""
|
||||
self.log_request(code)
|
||||
if message is None:
|
||||
if self.responses.has_key(code):
|
||||
message = self.responses[code][0]
|
||||
else:
|
||||
message = ''
|
||||
if self.request_version != 'HTTP/0.9':
|
||||
self.wfile.write("%s %s %s\r\n" %
|
||||
(self.protocol_version, str(code), message))
|
||||
self.send_header('Server', self.version_string())
|
||||
self.send_header('Date', self.date_time_string())
|
||||
|
||||
def send_header(self, keyword, value):
|
||||
"""Send a MIME header."""
|
||||
if self.request_version != 'HTTP/0.9':
|
||||
self.wfile.write("%s: %s\r\n" % (keyword, value))
|
||||
|
||||
def end_headers(self):
|
||||
"""Send the blank line ending the MIME headers."""
|
||||
if self.request_version != 'HTTP/0.9':
|
||||
self.wfile.write("\r\n")
|
||||
|
||||
def log_request(self, code='-', size='-'):
|
||||
"""Log an accepted request.
|
||||
|
||||
This is called by send_reponse().
|
||||
|
||||
"""
|
||||
|
||||
self.log_message('"%s" %s %s',
|
||||
self.requestline, str(code), str(size))
|
||||
|
||||
def log_error(self, *args):
|
||||
"""Log an error.
|
||||
|
||||
This is called when a request cannot be fulfilled. By
|
||||
default it passes the message on to log_message().
|
||||
|
||||
Arguments are the same as for log_message().
|
||||
|
||||
XXX This should go to the separate error log.
|
||||
|
||||
"""
|
||||
|
||||
apply(self.log_message, args)
|
||||
|
||||
def log_message(self, format, *args):
|
||||
"""Log an arbitrary message.
|
||||
|
||||
This is used by all other logging functions. Override
|
||||
it if you have specific logging wishes.
|
||||
|
||||
The first argument, FORMAT, is a format string for the
|
||||
message to be logged. If the format string contains
|
||||
any % escapes requiring parameters, they should be
|
||||
specified as subsequent arguments (it's just like
|
||||
printf!).
|
||||
|
||||
The client host and current date/time are prefixed to
|
||||
every message.
|
||||
|
||||
"""
|
||||
|
||||
sys.stderr.write("%s - - [%s] %s\n" %
|
||||
(self.address_string(),
|
||||
self.log_date_time_string(),
|
||||
format%args))
|
||||
|
||||
def version_string(self):
|
||||
"""Return the server software version string."""
|
||||
return self.server_version + ' ' + self.sys_version
|
||||
|
||||
def date_time_string(self):
|
||||
"""Return the current date and time formatted for a message header."""
|
||||
now = time.time()
|
||||
year, month, day, hh, mm, ss, wd, y, z = time.gmtime(now)
|
||||
s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
|
||||
self.weekdayname[wd],
|
||||
day, self.monthname[month], year,
|
||||
hh, mm, ss)
|
||||
return s
|
||||
|
||||
def log_date_time_string(self):
|
||||
"""Return the current time formatted for logging."""
|
||||
now = time.time()
|
||||
year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
|
||||
s = "%02d/%3s/%04d %02d:%02d:%02d" % (
|
||||
day, self.monthname[month], year, hh, mm, ss)
|
||||
return s
|
||||
|
||||
weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
||||
|
||||
monthname = [None,
|
||||
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||
|
||||
def address_string(self):
|
||||
"""Return the client address formatted for logging.
|
||||
|
||||
This version looks up the full hostname using gethostbyaddr(),
|
||||
and tries to find a name that contains at least one dot.
|
||||
|
||||
"""
|
||||
|
||||
host, port = self.client_address
|
||||
return socket.getfqdn(host)
|
||||
|
||||
# Essentially static class variables
|
||||
|
||||
# The version of the HTTP protocol we support.
|
||||
# Don't override unless you know what you're doing (hint: incoming
|
||||
# requests are required to have exactly this version string).
|
||||
protocol_version = "HTTP/1.0"
|
||||
|
||||
# The Message-like class used to parse headers
|
||||
MessageClass = mimetools.Message
|
||||
|
||||
# Table mapping response codes to messages; entries have the
|
||||
# form {code: (shortmessage, longmessage)}.
|
||||
# See http://www.w3.org/hypertext/WWW/Protocols/HTTP/HTRESP.html
|
||||
responses = {
|
||||
200: ('OK', 'Request fulfilled, document follows'),
|
||||
201: ('Created', 'Document created, URL follows'),
|
||||
202: ('Accepted',
|
||||
'Request accepted, processing continues off-line'),
|
||||
203: ('Partial information', 'Request fulfilled from cache'),
|
||||
204: ('No response', 'Request fulfilled, nothing follows'),
|
||||
|
||||
301: ('Moved', 'Object moved permanently -- see URI list'),
|
||||
302: ('Found', 'Object moved temporarily -- see URI list'),
|
||||
303: ('Method', 'Object moved -- see Method and URL list'),
|
||||
304: ('Not modified',
|
||||
'Document has not changed singe given time'),
|
||||
|
||||
400: ('Bad request',
|
||||
'Bad request syntax or unsupported method'),
|
||||
401: ('Unauthorized',
|
||||
'No permission -- see authorization schemes'),
|
||||
402: ('Payment required',
|
||||
'No payment -- see charging schemes'),
|
||||
403: ('Forbidden',
|
||||
'Request forbidden -- authorization will not help'),
|
||||
404: ('Not found', 'Nothing matches the given URI'),
|
||||
|
||||
500: ('Internal error', 'Server got itself in trouble'),
|
||||
501: ('Not implemented',
|
||||
'Server does not support this operation'),
|
||||
502: ('Service temporarily overloaded',
|
||||
'The server cannot process the request due to a high load'),
|
||||
503: ('Gateway timeout',
|
||||
'The gateway server did not receive a timely response'),
|
||||
|
||||
}
|
||||
|
||||
|
||||
def test(HandlerClass = BaseHTTPRequestHandler,
|
||||
ServerClass = HTTPServer):
|
||||
"""Test the HTTP request handler class.
|
||||
|
||||
This runs an HTTP server on port 8000 (or the first command line
|
||||
argument).
|
||||
|
||||
"""
|
||||
|
||||
if sys.argv[1:]:
|
||||
port = int(sys.argv[1])
|
||||
else:
|
||||
port = 8000
|
||||
server_address = ('', port)
|
||||
|
||||
httpd = ServerClass(server_address, HandlerClass)
|
||||
|
||||
sa = httpd.socket.getsockname()
|
||||
print "Serving HTTP on", sa[0], "port", sa[1], "..."
|
||||
httpd.serve_forever()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test()
|
||||
|
||||
# arch-tag: 567449b3-cc90-45b6-bbe3-1e113995bdae
|
@ -1,7 +1,24 @@
|
||||
//
|
||||
// CPP file for semantic-ia-utest
|
||||
// completion engine unit tests.
|
||||
//
|
||||
// testdoublens.cpp --- semantic-ia-utest completion engine unit tests
|
||||
|
||||
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
// Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
// This file is part of GNU Emacs.
|
||||
|
||||
// GNU Emacs 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "testdoublens.hpp"
|
||||
|
||||
namespace Name1 {
|
||||
@ -29,7 +46,7 @@ namespace Name1 {
|
||||
void Foo::sendStuff(int /* a */, int /* b */) // ^3^
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
} // namespace Name2
|
||||
} // namespace Name1
|
||||
|
||||
@ -44,7 +61,7 @@ int test_fcn () {
|
||||
Name1::Name2::F//-4-
|
||||
// #4# ( "Foo" )
|
||||
;
|
||||
|
||||
|
||||
// @TODO - get this working...
|
||||
Name1::stage2_Foo::M//-5-
|
||||
/// #5# ( "Mumble" )
|
||||
@ -58,15 +75,15 @@ stage3_Foo foo_fcn() {
|
||||
|
||||
// Second test from Ravikiran Rajagopal
|
||||
|
||||
namespace A {
|
||||
namespace A {
|
||||
class foo {
|
||||
public:
|
||||
void aa();
|
||||
void bb();
|
||||
};
|
||||
}
|
||||
namespace A {
|
||||
class bar {
|
||||
namespace A {
|
||||
class bar {
|
||||
public:
|
||||
void xx();
|
||||
public:
|
||||
@ -96,7 +113,7 @@ namespace a {
|
||||
|
||||
int Bar::baz()
|
||||
{
|
||||
return dum// -7-
|
||||
return dum// -7-
|
||||
// #7# ( "dumdum" )
|
||||
;
|
||||
}
|
||||
|
@ -1,6 +1,24 @@
|
||||
//
|
||||
// Header file used in one of the ia-utest tests.
|
||||
//
|
||||
// testdoublens.hpp --- Header file used in one of the Semantic tests
|
||||
|
||||
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
// Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
// This file is part of GNU Emacs.
|
||||
|
||||
// GNU Emacs 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace Name1 {
|
||||
namespace Name2 {
|
||||
|
||||
|
@ -1,24 +1,23 @@
|
||||
/** testjavacomp.java ---
|
||||
*
|
||||
* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
*
|
||||
* This file is part of GNU Emacs.
|
||||
*
|
||||
* GNU Emacs 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
// testjavacomp.java --- Semantic unit test for Java
|
||||
|
||||
// Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
// Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
// This file is part of GNU Emacs.
|
||||
|
||||
// GNU Emacs 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package tests.testjavacomp;
|
||||
|
||||
|
@ -1,6 +1,24 @@
|
||||
/* Attempt to test the C preprocessor
|
||||
*
|
||||
*/
|
||||
/* testspp.cpp --- Semantic unit test for the C preprocessor
|
||||
|
||||
Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
int some_fcn (){}
|
||||
|
||||
|
@ -1,5 +1,23 @@
|
||||
/* Test CPP/SPP Replacement
|
||||
*/
|
||||
/* testsppreplace.c --- unit test for CPP/SPP Replacement
|
||||
Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* TEST: The EMU keyword doesn't screw up the function defn. */
|
||||
#define EMU
|
||||
|
@ -1,5 +1,25 @@
|
||||
/* What the SPP replace file would looklike with MACROS replaced.
|
||||
*/
|
||||
/* testsppreplaced.c --- unit test for CPP/SPP Replacement
|
||||
Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* What the SPP replace file would looklike with MACROS replaced: */
|
||||
|
||||
/* TEST: The EMU keyword doesn't screw up the function defn. */
|
||||
char parse_around_emu ()
|
||||
|
@ -1,68 +0,0 @@
|
||||
// Combinations of templates and structure inheritance.
|
||||
//
|
||||
// Created by Alex Ott.
|
||||
|
||||
template <typename DerivedT>
|
||||
struct grammar {
|
||||
public:
|
||||
typedef grammar<DerivedT> self_t;
|
||||
typedef DerivedT const& embed_t;
|
||||
grammar() {}
|
||||
~grammar() { }
|
||||
void use_parser() const { }
|
||||
void test1() { }
|
||||
};
|
||||
|
||||
struct PDFbool_parser : public grammar<PDFbool_parser> {
|
||||
PDFbool_parser() {}
|
||||
template <typename scannerT> struct definition {
|
||||
typedef typename scannerT::iterator_t iterator_t;
|
||||
int top;
|
||||
definition(const PDFbool_parser& /*self*/) {
|
||||
return ;
|
||||
}
|
||||
const int start() const {
|
||||
return top;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
PDFbool_parser PDFbool_p = PDFbool_parser();
|
||||
PDFbool_p.//-1-
|
||||
;
|
||||
// #1# ("definition" "embed_t" "self_t" "test1" "use_parser")
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
template <class Derived> struct Base {
|
||||
public:
|
||||
void interface()
|
||||
{
|
||||
// ...
|
||||
static_cast<Derived*>(this)->implementation();
|
||||
// ...
|
||||
}
|
||||
|
||||
static void static_func()
|
||||
{
|
||||
// ...
|
||||
Derived::static_sub_func();
|
||||
// ...
|
||||
}
|
||||
};
|
||||
|
||||
struct Derived : Base<Derived> {
|
||||
void implementation() { }
|
||||
static void static_sub_func() { }
|
||||
};
|
||||
|
||||
int foo () {
|
||||
Derived d;
|
||||
d.//-2-
|
||||
;
|
||||
// #2# ("implementation" "interface" "static_func" "static_sub_func")
|
||||
}
|
||||
|
||||
// arch-tag: d6e39f96-525e-44af-8cd1-d03e1829acd3
|
@ -1,5 +1,23 @@
|
||||
/* Special test file for Semantic Analyzer and complex C++ inheritance.
|
||||
*/
|
||||
// testsubclass.cpp --- unit test for analyzer and complex C++ inheritance
|
||||
|
||||
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
// Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
// This file is part of GNU Emacs.
|
||||
|
||||
// GNU Emacs 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//#include <iostream>
|
||||
#include "testsubclass.hh"
|
||||
@ -94,7 +112,7 @@ moose deer::alces::createMoose()
|
||||
MooseVariableName = createMoose();
|
||||
|
||||
doLatinStuff(MooseVariableName);
|
||||
|
||||
|
||||
tmp = this.f// -1-
|
||||
// #1# ( "fAlcesBool" "fIsValid" "fLatin" )
|
||||
;
|
||||
@ -125,7 +143,7 @@ moose deer::alces::createMoose()
|
||||
int someFunction(int mPickle)
|
||||
{
|
||||
moose mMoose = deer::alces::createMoose();
|
||||
|
||||
|
||||
if (mPickle == 1) {
|
||||
|
||||
int mOption1 = 2;
|
||||
@ -152,7 +170,7 @@ namespace pub_priv {
|
||||
class A{
|
||||
private:
|
||||
void private_a(){}
|
||||
public:
|
||||
public:
|
||||
void public_a();
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,23 @@
|
||||
/* Special test file for Semantic Analyzer and complex C++ inheritance.
|
||||
*
|
||||
* Header file for testsubclass.cpp with class defns but no
|
||||
* implementations.
|
||||
*/
|
||||
// testsubclass.hh --- unit test for analyzer and complex C++ inheritance
|
||||
|
||||
// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
// Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
// This file is part of GNU Emacs.
|
||||
|
||||
// GNU Emacs 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//#include <cmath>
|
||||
// #include <stdio.h>
|
||||
|
@ -1,92 +0,0 @@
|
||||
// Templates Test file:
|
||||
// Written by 'Raf'
|
||||
|
||||
template <class T, int U, class V>
|
||||
class read_ref {
|
||||
public:
|
||||
const T* read_ref_member_one( T);
|
||||
const V* read_ref_member_two();
|
||||
};
|
||||
|
||||
namespace NS {
|
||||
template <class T, int U, class V>
|
||||
class ref {
|
||||
public:
|
||||
read_ref<T,10,V> operator->() {
|
||||
m_// -1-
|
||||
;
|
||||
// #1# ( "m_datas" )
|
||||
}
|
||||
|
||||
private:
|
||||
T m_datas[U];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class FooOne {
|
||||
public:
|
||||
int fooOneMember();
|
||||
};
|
||||
|
||||
class FooTwo {
|
||||
public:
|
||||
int fooTwoMember();
|
||||
};
|
||||
|
||||
class FooThree {
|
||||
public:
|
||||
int fooThreeMember();
|
||||
|
||||
FooOne * operator->();
|
||||
};
|
||||
|
||||
typedef ref<FooOne, 10,FooTwo> Test;
|
||||
|
||||
using NS;
|
||||
|
||||
void
|
||||
main(void) {
|
||||
ref<FooOne, 10, FooTwo> v;
|
||||
|
||||
v->read_ref_member_one()-> // -2-
|
||||
;
|
||||
// #2# ( "fooOneMember" )
|
||||
|
||||
v->read_ref_member_two()-> // -3-
|
||||
;
|
||||
// #3# ( "fooTwoMember" )
|
||||
|
||||
v-> // -4-
|
||||
;
|
||||
// #4# ( "read_ref_member_one" "read_ref_member_two" )
|
||||
|
||||
Test t;
|
||||
|
||||
t->read_ref_member_two()-> // -5-
|
||||
;
|
||||
// #5# ( "fooTwoMember" )
|
||||
|
||||
ref<FooOne, 10, FooThree> v2;
|
||||
|
||||
v2->read_ref_member_two()-> // -6-
|
||||
;
|
||||
// #6# ( "fooOneMember" )
|
||||
|
||||
/* Try all these things by also specifying the namespace in the name. */
|
||||
NS::ref<FooOne, 10, FooTwo> v3;
|
||||
|
||||
v3->read_ref_member_one()-> // -7-
|
||||
;
|
||||
// #7# ( "fooOneMember" )
|
||||
|
||||
v3->read_ref_member_two()-> // -8-
|
||||
;
|
||||
// #8# ( "fooTwoMember" )
|
||||
|
||||
v3->read_ref_member_two// @1@ 5
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
// arch-tag: 03cbb8c3-3d01-42ab-b416-42a08ea7b896
|
@ -1,16 +1,31 @@
|
||||
// Sample with some fake bits out of std::string
|
||||
//
|
||||
// testtypedefs.cpp --- Sample with some fake bits out of std::string
|
||||
|
||||
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
// Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
// This file is part of GNU Emacs.
|
||||
|
||||
// GNU Emacs 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// Thanks Ming-Wei Chang for these examples.
|
||||
|
||||
namespace std {
|
||||
|
||||
template <T>class basic_string {
|
||||
|
||||
public:
|
||||
void resize(int);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
typedef std::basic_string<char> mstring;
|
||||
@ -18,41 +33,34 @@ typedef std::basic_string<char> mstring;
|
||||
using namespace std;
|
||||
typedef basic_string<char> bstring;
|
||||
|
||||
|
||||
int main(){
|
||||
mstring a;
|
||||
|
||||
a.// -1-
|
||||
;
|
||||
// #1# ( "resize" )
|
||||
|
||||
bstring b;
|
||||
// It doesn't work here.
|
||||
b.// -2-
|
||||
;
|
||||
// #2# ( "resize" )
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ------------------
|
||||
|
||||
class Bar
|
||||
class Bar
|
||||
{
|
||||
public:
|
||||
void someFunc() {}
|
||||
|
||||
};
|
||||
|
||||
typedef Bar new_Bar;
|
||||
|
||||
template <class mytype>
|
||||
class TBar
|
||||
class TBar
|
||||
{
|
||||
public:
|
||||
void otherFunc() {}
|
||||
|
||||
};
|
||||
|
||||
typedef TBar<char> new_TBar;
|
||||
@ -65,11 +73,9 @@ int main()
|
||||
nb.// -3-
|
||||
;
|
||||
// #3# ("someFunc")
|
||||
|
||||
ntb.// -4-
|
||||
;
|
||||
// #4# ("otherFunc")
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,134 +0,0 @@
|
||||
// Test using statements in C++
|
||||
|
||||
#include <adstdio.h>
|
||||
|
||||
#include <testusing.hh>
|
||||
|
||||
namespace moose {
|
||||
|
||||
class MyClass;
|
||||
class Point;
|
||||
|
||||
typedef MyClass snerk;
|
||||
}
|
||||
|
||||
namespace moose {
|
||||
|
||||
class Point;
|
||||
class MyClass;
|
||||
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
int global_variable = 0;
|
||||
|
||||
};
|
||||
|
||||
using moose::MyClass;
|
||||
|
||||
void someFcn() {
|
||||
|
||||
MyClass f;
|
||||
|
||||
f.//-1-
|
||||
; //#1# ( "getVal" "setVal" )
|
||||
|
||||
}
|
||||
|
||||
// Code from Zhiqiu Kong
|
||||
|
||||
namespace panda {
|
||||
|
||||
using namespace bread_name;
|
||||
|
||||
int func()
|
||||
{
|
||||
bread test;
|
||||
test.//-2-
|
||||
;// #2# ( "geta" )
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Local using statements and aliased types
|
||||
// Code from David Engster
|
||||
|
||||
void func2()
|
||||
{
|
||||
using namespace somestuff;
|
||||
OneClass f;
|
||||
f.//-3-
|
||||
; //#3# ( "aFunc" "anInt" )
|
||||
}
|
||||
|
||||
void func3()
|
||||
{
|
||||
using somestuff::OneClass;
|
||||
OneClass f;
|
||||
f.//-4-
|
||||
; //#4# ( "aFunc" "anInt" )
|
||||
}
|
||||
|
||||
// Dereferencing alias types created through 'using' statements
|
||||
|
||||
// Alias with fully qualified name
|
||||
void func4()
|
||||
{
|
||||
otherstuff::OneClass f;
|
||||
f. //-5-
|
||||
; //#5# ( "aFunc" "anInt" )
|
||||
}
|
||||
|
||||
// Alias through namespace directive
|
||||
void func5()
|
||||
{
|
||||
using namespace otherstuff;
|
||||
OneClass f;
|
||||
f. //-6-
|
||||
; //#6# ( "aFunc" "anInt" )
|
||||
}
|
||||
|
||||
// Check name hiding
|
||||
void func6()
|
||||
{
|
||||
using namespace morestuff;
|
||||
OneClass f; // Alias for somestuff::OneClass
|
||||
f. //-7-
|
||||
; //#7# ( "aFunc" "anInt" )
|
||||
aStruct g; // This however is morestuff::aStruct !
|
||||
g. //-8-
|
||||
; //#8# ( "anotherBar" "anotherFoo" )
|
||||
}
|
||||
|
||||
// Alias of an alias
|
||||
// Currently doesn't work interactively for some reason.
|
||||
void func6()
|
||||
{
|
||||
using namespace evenmorestuff;
|
||||
OneClass f;
|
||||
f. //-7-
|
||||
; //#7# ( "aFunc" "anInt" )
|
||||
}
|
||||
|
||||
// Alias for struct in nested namespace, fully qualified
|
||||
void func7()
|
||||
{
|
||||
outer::StructNested f;
|
||||
f.//-8-
|
||||
; //#8# ( "one" "two" )
|
||||
}
|
||||
|
||||
// Alias for nested namespace
|
||||
void func8()
|
||||
{
|
||||
using namespace outerinner;
|
||||
StructNested f;
|
||||
AnotherStruct g;
|
||||
f.//-9-
|
||||
; //#9# ( "one" "two" )
|
||||
g.//-10-
|
||||
; //#10# ( "four" "three" )
|
||||
}
|
||||
|
||||
// arch-tag: 8e68d5d1-4d48-47c6-a910-d8d6b66b2768
|
@ -1,127 +0,0 @@
|
||||
// test usings header file.
|
||||
|
||||
namespace moose {
|
||||
|
||||
class Point;
|
||||
|
||||
class MyClass;
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace moose {
|
||||
|
||||
class Point;
|
||||
|
||||
class MyClass {
|
||||
public:
|
||||
MyClass() : fVal(0) {
|
||||
}
|
||||
|
||||
~MyClass() {};
|
||||
|
||||
/**
|
||||
* fVal Accessors
|
||||
* @{
|
||||
*/
|
||||
int getVal() const {
|
||||
return fVal;
|
||||
}
|
||||
void setVal(int Val) const {
|
||||
fVal = Val;
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
private:
|
||||
int fVal;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace deer {
|
||||
|
||||
class Pickle;
|
||||
|
||||
};
|
||||
|
||||
// Code from Zhiqiu Kong
|
||||
|
||||
#ifndef BREAD_H
|
||||
#define BREAD_H
|
||||
|
||||
namespace bread_name {
|
||||
class bread
|
||||
{
|
||||
public:
|
||||
void geta();
|
||||
private:
|
||||
int m_a;
|
||||
int m_b;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Code from David Engster
|
||||
// Creating alias types through 'using' trickery
|
||||
|
||||
namespace somestuff {
|
||||
class OneClass {
|
||||
public:
|
||||
void aFunc();
|
||||
int anInt;
|
||||
};
|
||||
struct aStruct {
|
||||
int foo;
|
||||
int bar;
|
||||
};
|
||||
}
|
||||
|
||||
namespace otherstuff {
|
||||
// make otherstuff::OneClass an alias for somestuff::OneClass
|
||||
using somestuff::OneClass;
|
||||
}
|
||||
|
||||
namespace morestuff {
|
||||
// make morestuff an alias namespace for somestuff
|
||||
using namespace somestuff;
|
||||
// but hide aStruct with own type
|
||||
struct aStruct {
|
||||
int anotherFoo;
|
||||
int anotherBar;
|
||||
};
|
||||
}
|
||||
|
||||
// We can also create an alias for an alias
|
||||
namespace evenmorestuff {
|
||||
using otherstuff::OneClass;
|
||||
}
|
||||
|
||||
// Now with nested namespaces
|
||||
namespace outer {
|
||||
namespace inner {
|
||||
struct StructNested {
|
||||
int one;
|
||||
int two;
|
||||
};
|
||||
struct AnotherStruct {
|
||||
int three;
|
||||
int four;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Elevate the first struct into 'outer'
|
||||
// so that we can access it via 'outer::StructNested'
|
||||
namespace outer {
|
||||
using outer::inner::StructNested;
|
||||
}
|
||||
|
||||
// Create an alias for a nested namespace
|
||||
namespace outerinner {
|
||||
// equivalent to 'namespace outerinner = outer::inner;'
|
||||
using namespace outer::inner;
|
||||
}
|
||||
|
||||
// arch-tag: f7e59fad-100b-47d3-ae8b-a8390a026ade
|
@ -1,6 +1,25 @@
|
||||
/*
|
||||
* Test variable and function names, lists of variables on one line, etc.
|
||||
*/
|
||||
/* testvarnames.cpp
|
||||
Test variable and function names, lists of variables on one line, etc.
|
||||
|
||||
Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
|
||||
Author: Eric M. Ludlam <eric@siege-engine.com>
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
struct independent {
|
||||
int indep_1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user