diff --git a/source/cartastraccia/actor.d b/source/cartastraccia/actor.d index 31bbf5d..757ad71 100644 --- a/source/cartastraccia/actor.d +++ b/source/cartastraccia/actor.d @@ -1,3 +1,26 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * Feed actor logic and inter-actor communication primitives. + * +*/ + module cartastraccia.actor; import cartastraccia.rss; diff --git a/source/cartastraccia/asciiart.d b/source/cartastraccia/asciiart.d index 73ffe6d..e7fb2e0 100644 --- a/source/cartastraccia/asciiart.d +++ b/source/cartastraccia/asciiart.d @@ -1,3 +1,29 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * Ascii art for the title bar of Cartastraccia. + * --- + * Credits to http://www.patorjk.com/software/taag/ + * for the incredibly useful and enjoyable tool. + * +*/ + module cartastraccia.asciiart; static immutable string asciiArt = r" diff --git a/source/cartastraccia/config.d b/source/cartastraccia/config.d index 9527570..59e492f 100644 --- a/source/cartastraccia/config.d +++ b/source/cartastraccia/config.d @@ -1,3 +1,26 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * Config (feeds) file parsing. + * +*/ + module cartastraccia.config; import pegged.grammar; diff --git a/source/cartastraccia/endpoint.d b/source/cartastraccia/endpoint.d index c3c5ab5..9533de8 100644 --- a/source/cartastraccia/endpoint.d +++ b/source/cartastraccia/endpoint.d @@ -1,3 +1,26 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * Pluggable endpoint interface using Vibe.d services. + * +*/ + module cartastraccia.endpoint; import cartastraccia.config; diff --git a/source/cartastraccia/include/mrss.d b/source/cartastraccia/include/mrss.d index 58ba2cf..44887ac 100644 --- a/source/cartastraccia/include/mrss.d +++ b/source/cartastraccia/include/mrss.d @@ -1,20 +1,63 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * --- + * This is a direct translation of the mrss.h header file + * its only purpose is to act as an interface from its original C source to + * the D programming language. + * All credit for the original source goes to: + * bakunin - Andrea Marchesini + * https://www.autistici.org/bakunin/libmrss/ + * --- + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * D interface file for libmrss. + * +*/ + + module cartastraccia.include.mrss; +import std.string : fromStringz; +import std.conv : to; + import core.stdc.time; +string ZtoString(const char* c) nothrow +{ + if (c !is null) + return to!string(fromStringz(c)); + else + return null; +} + +auto toZString(string s, ref size_t len) nothrow +{ + char[] ret = s.to!(char[]); + if (ret[$-1] != '\0') + ret ~= "\0".to!(char[]); + len = ret.length; + return ret.ptr; +} + extern(C) nothrow { -//typedef struct mrss_t mrss_t; -//typedef struct mrss_options_t mrss_options_t; -//typedef struct mrss_item_t mrss_item_t; -//typedef struct mrss_category_t mrss_category_t; -//typedef struct mrss_hour_t mrss_hour_t; -//typedef struct mrss_day_t mrss_day_t; -//typedef struct mrss_tag_t mrss_tag_t; -//typedef struct mrss_attribute_t mrss_attribute_t; -//typedef void * mrss_generic_t; - alias mrss_generic_t = void*; /** This enum describes the error type of libmrss */ diff --git a/source/cartastraccia/renderer.d b/source/cartastraccia/renderer.d index 91cf99f..a093884 100644 --- a/source/cartastraccia/renderer.d +++ b/source/cartastraccia/renderer.d @@ -1,3 +1,27 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * Feeds visualization rendering (HTML only, for now). + * +*/ + + module cartastraccia.renderer; import cartastraccia.rss; diff --git a/source/cartastraccia/rss.d b/source/cartastraccia/rss.d index c55c7dd..1b19ba3 100644 --- a/source/cartastraccia/rss.d +++ b/source/cartastraccia/rss.d @@ -1,3 +1,25 @@ +/** + * Copyright (c) 2019 Francesco Galla` - + * + * This file is part of cartastraccia. + * + * cartastraccia 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. + * + * cartastraccia 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 cartastraccia. If not, see . + * --- + * + * RSS data structures, types and parsing. + * +*/ module cartastraccia.rss; import cartastraccia.actor : FeedActorRequest; @@ -17,7 +39,6 @@ alias RSS = SumType!(ValidRSS, InvalidRSS, FailedRSS); - /** * In case the RSS feed couldn't be loaded */ @@ -124,6 +145,10 @@ } else logFatal("Invalid data format received from webserver."); } +/** + * Entry point for parsing a rss feed (represented as string) + * Parsing done using libmrss (see cartastraccia.include.mrss) +*/ void parseRSS(ref RSS rss, string feed) @trusted { mrss_t* rssData; @@ -185,20 +210,3 @@ rss.channel.items ~= newItem; } - -string ZtoString(const char* c) -{ - if (c !is null) - return to!string(fromStringz(c)); - else - return null; -} - -auto toZString(string s, ref size_t len) -{ - char[] ret = s.to!(char[]); - if (ret[$-1] != '\0') - ret ~= "\0".to!(char[]); - len = ret.length; - return ret.ptr; -}