/[ascend]/trunk/pygtk/symchar.cpp
ViewVC logotype

Annotation of /trunk/pygtk/symchar.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 709 - (hide annotations) (download) (as text)
Wed Jun 28 16:28:57 2006 UTC (17 years, 11 months ago) by johnpye
File MIME type: text/x-c++src
File size: 1248 byte(s)
Monster commit!
Lots of recommenting and reorganising of external relations-related stuff.
Replaced a lot of ascmalloc and asccalloc calls with the new ASC_NEW* macros.
Fixed (?) the problem Art is having with icons in PyGTK.
Turned on -Wall in SConstruct and fixed up a stack of warnings.
Removed the redundant exit(2) from after Asc_Panic calls and added __attribute__((noreturn)).
Set doxygen to create callgraphs to level 2, updated doxyfile to version 1.4.7.
Fixed up building of extfntest.c.
1 johnpye 132 #include <stdexcept>
2     using namespace std;
3    
4     #include "symchar.h"
5    
6     /*
7     SymChar::SymChar(){
8     throw runtime_error("Can't create empty SymChar");
9     }
10     */
11     SymChar::SymChar(const SymChar &old) : sc(old.sc){
12     // nothing else
13     }
14    
15     SymChar::SymChar(const string &name){
16     sc = AddSymbol(name.c_str());
17     }
18    
19    
20     SymChar::SymChar(const char *name){
21     sc = AddSymbol(name);
22     }
23    
24     SymChar::SymChar(const symchar *hash) : sc(sc){
25     cerr << "CREATING SymChar from symchar*, '" << toString() << "'" << endl;
26     // nothing else
27     }
28    
29     SymChar::SymChar(const struct InstanceName &in) {
30    
31     //cerr << "Symchar(InstanceName) called" << endl;
32    
33     if(InstanceNameType(in) == IntArrayIndex){
34     char n[50];
35 johnpye 709 snprintf(n,50,"%ld",InstanceIntIndex(in));
36 johnpye 132 sc = AddSymbol(n);
37     }else{
38     sc = InstanceNameStr(in);
39     }
40    
41     if(sc==NULL){
42     throw runtime_error("Invalid name in SymChar::SymChar(InstanceName)");
43     }
44     //cerr << "CREATING SymChar from InstanceName, '" << getName() << "'" << endl;
45     }
46    
47     const char *
48     SymChar::toString() const{
49     return SCP(sc);
50     }
51    
52     bool
53     SymChar::operator==(const SymChar &other) const{
54     if(sc == other.sc)return true;
55     return false;
56     }
57    
58     const symchar *
59     SymChar::getInternalType() const{
60     return sc;
61     }
62    
63     ostream& operator << (ostream& os, const SymChar& s){
64     return os << s.toString();
65     }

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22