File: txinline.h

package info (click to toggle)
tralics 2.14.4-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 17,152 kB
  • ctags: 8,260
  • sloc: cpp: 49,403; xml: 18,145; sh: 140; makefile: 118
file content (129 lines) | stat: -rw-r--r-- 3,413 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// -*- C++ -*-
// $Id: txinline.h,v 2.26 2008/07/21 06:36:20 grimm Exp $
// TRALICS, copyright (C)INRIA/apics (Jose' Grimm) 2003,2007,2008

// This software is governed by the CeCILL license under French law and
// abiding by the rules of distribution of free software.  You can  use, 
// modify and/ or redistribute the software under the terms of the CeCILL
// license as circulated by CEA, CNRS and INRIA at the following URL
// "http://www.cecill.info". 
// (See the file COPYING in the main directory for details)

// This file contains some inline functions and the tralics 
// namespace declarations

// We also declare some global variables here

// See comments in tralics.C where these variables are defined
namespace main_ns {
  extern FullLogger log_and_tty;
  extern HalfLogger log_or_tty;
  extern Buffer path_buffer;
  extern int nb_errs; 
  extern bool file_ended;
  extern bool no_xml_error;
  extern bool use_quotes;
}


extern Logger& the_log;  // not in a namespace ?


namespace tralics_ns {
  bool is_leap_year(int y);
  int year_length(int y);
  void make_names();
  void boot_math(bool);
  bool file_exists(String name);
  bool find_in_confdir(const string & s, bool retry);
  bool find_in_path(const string & s);
  bool find_no_path(const string & s);
  void read_a_file (LinePtr&,string x, int spec);
  String make_string(String);
  bool titlepage_is_valid();
  bool file_exists(String name);
  bool file_exists(string name);
  bool file_exists(Buffer&);
  void bibtex_bootagain();
  void bibtex_boot(String b,String,string,bool,bool);
  void Titlepage_create(LinePtr& x);
  void Titlepage_start(bool);
  bool exists(const vector<string>&, string);
  void bibtex_set_nocite();
  void bibtex_insert_jobname();
  fstream* open_file(String name,bool);
  fstream* open_file(string name,bool);
  void close_file(fstream*);
  bool only_digits(const string& s);
  String get_out_dir(string);
  string get_short_jobname();
};

namespace err_ns {
  extern Buffer local_buf;
  void signal_error(String s,int);
}

namespace config_ns {
  string find_one_key(const string& name,const string&key);
  string pers_rc(const string& rc);
  void check_RC(Buffer& s,Xml*);
  string find_keys(const string& name);
  bool start_interpret(Buffer&B, String s);
  void interpret_list(const string&, Buffer&B);
  bool assign(Buffer& a, Buffer& b);
  bool assign_name(String A,String B);
  bool assign_att(String A, String B);

}

inline bool operator==(const Buffer& B, String s) 
{ 
  return strcmp(B.c_str(),s)== 0;
}

inline bool is_vowel(char c) 
{
  return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}

// True if it is an accent character, like \^. 
inline bool is_accent_char(char c)
{
  return c=='\'' || c=='`' || c=='^' || c=='"' || c=='~' || c== '.' || c=='=';
}

inline bool is_tp_delim (char c)
{
  return c == '<' || c == '\\' || c == '"';
}


inline bool operator ==(Token a, Token b) 
{ 
  return a.get_val() == b.get_val(); 
}

inline bool operator !=(Token a, Token b) 
{ 
  return a.get_val() != b.get_val(); 
}

inline Istring::Istring(const Buffer& X) :
 value(the_main->SH.find(X.c_str())) {}

inline Istring::Istring(String s) :
  value(the_main->SH.find(s)) {}

inline Istring::Istring(string s) :
  value(the_main->SH.find(s)) {}

inline String Istring::c_str()const 
{
  return the_main->SH[value]; 
}

inline String Istring::p_str()const 
{
  return the_main->SH.p_str(value); 
}