private Devhelp.MarkupWriter _devhelpwriter;
- construct {
- _renderer = new HtmlRenderer (this);
- }
-
private string get_path (Api.Node element) {
return element.get_full_name () + ".html";
}
private const string js_path_wiki = "../scripts.js";
private const string js_path = "../scripts.js";
- construct {
- _renderer = new HtmlRenderer (this);
- }
-
private string get_real_path ( Api.Node element ) {
return GLib.Path.build_filename ( this.settings.path, element.package.name, element.get_full_name () + ".html" );
}
context.add_source_file (source_file);
} else if (source.has_suffix (".vapi")) {
string file_name = Path.get_basename (source);
- file_name = file_name.ndup (file_name.length - ".vapi".length);
+ file_name = file_name.substring (0, file_name.length - ".vapi".length);
var vfile = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, rpath);
Package vdpkg = new Package (vfile, file_name);
return true;
}
- /* cp from valacompiler.vala, ported from glibc */
- private static bool ends_with_dir_separator (string s) {
- return Path.is_dir_separator (s.offset (s.length - 1).get_char ());
- }
-
- public string realpath (string name) {
- string rpath;
-
- // start of path component
- weak string start;
- // end of path component
- weak string end;
-
- if (!Path.is_absolute (name)) {
- // relative path
- rpath = Environment.get_current_dir ();
-
- start = end = name;
- } else {
- // set start after root
- start = end = Path.skip_root (name);
-
- // extract root
- rpath = name.substring (0, name.pointer_to_offset (start));
- }
-
- long root_len = rpath.pointer_to_offset (Path.skip_root (rpath));
-
- for (; start.get_char () != 0; start = end) {
- // skip sequence of multiple path-separators
- while (Path.is_dir_separator (start.get_char ())) {
- start = start.next_char ();
- }
-
- // find end of path component
- long len = 0;
- for (end = start; end.get_char () != 0 && !Path.is_dir_separator (end.get_char ()); end = end.next_char ()) {
- len++;
- }
-
- if (len == 0) {
- break;
- } else if (len == 1 && start.get_char () == '.') {
- // do nothing
- } else if (len == 2 && start.has_prefix ("..")) {
- // back up to previous component, ignore if at root already
- if (rpath.length > root_len) {
- do {
- rpath = rpath.substring (0, rpath.length - 1);
- } while (!ends_with_dir_separator (rpath));
- }
- } else {
- if (!ends_with_dir_separator (rpath)) {
- rpath += Path.DIR_SEPARATOR_S;
- }
-
- rpath += start.substring (0, len);
- }
- }
-
- if (rpath.length > root_len && ends_with_dir_separator (rpath)) {
- rpath = rpath.substring (0, rpath.length - 1);
- }
-
- if (Path.DIR_SEPARATOR != '/') {
- // don't use backslashes internally,
- // to avoid problems in #include directives
- string[] components = rpath.split ("\\");
- rpath = string.joinv ("/", components);
- }
-
- return rpath;
+ public string realpath (string basedir) {
+ return Vala.CodeContext.realpath (basedir);
}
}
}
protected virtual void write_wiki_page (WikiPage page, string contentp, string css_path, string js_path, string pkg_name) {
- GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.ndup(page.name.length-7).replace ("/", ".")+"html"), "w");
+ GLib.FileStream file = GLib.FileStream.open (Path.build_filename(contentp, page.name.substring (0, page.name.length-7).replace ("/", ".")+"html"), "w");
writer = new MarkupWriter (file);
_renderer.set_writer (writer);
this.write_file_header (css_path, js_path, pkg_name);
private string translate_wiki_name (WikiPage page) {
var name = page.name;
-
- return name.ndup (name.pointer_to_offset (name.chr (-1, '.'))).replace ("/", ".") + ".html";
+ return name.substring (name.last_index_of_char ('.')).replace ("/", ".") + ".html";
}
Api.Node? symbol = null;
if (symbol_name.has_prefix ("c::")) {
- symbol = tree.search_symbol_cstr (symbol_name.offset (3));
+ symbol = tree.search_symbol_cstr (symbol_name.substring (3));
} else {
symbol = tree.search_symbol_str (null, symbol_name);
}
public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
if (symbol_name.has_prefix ("c::")) {
- _symbol_name = _symbol_name.offset (3);
+ _symbol_name = _symbol_name.substring (3);
_symbol = api_root.search_symbol_cstr (symbol_name);
if (_symbol != null) {
symbol_name = _symbol.name;
public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
if (symbol_name.has_prefix ("c::")) {
- symbol_name = symbol_name.offset (3);
+ symbol_name = symbol_name.substring (3);
symbol = api_root.search_symbol_cstr (symbol_name);
if (symbol != null) {
symbol_name = _symbol.name;