SUBDIRS = src
+if BUILD_EXAMPLE
+SUBDIRS += example
+endif
+
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = README COPYING AUTHORS ChangeLog INSTALL NEWS
+EXTRA_DIST = \
+ README \
+ COPYING \
+ AUTHORS \
+ ChangeLog \
+ INSTALL \
+ NEWS \
+ autogen.sh
AC_CONFIG_COMMANDS(
[summary],
[[echo ""
- echo -e "libvcard will be compiled with these settings:"
+ echo -e "libvCard will be compiled with these settings:"
echo -e "\tCFLAGS:\t\t${CFLAGS}"
echo -e "\tLIBS:\t\t${LIBS}"
echo -e "\tExample:\t${EXAMPLE}"
AC_OUTPUT([
Makefile
+ example/Makefile
src/Makefile
])
--- /dev/null
+AUTOMAKE_OPTIONS = gnu
+
+AM_CPPFLAGS = \
+ @GLIB_CFLAGS@ \
+ -I$(top_srcdir) -I$(top_builddir) \
+ -I$(top_srcdir)/src -I$(top_builddir)/src \
+ -I$(top_srcdir)/example -I$(top_builddir)/example
+
+bin_PROGRAMS = vcard-example
+
+vcard_example_SOURCES = \
+ vcard-example
+
+vcard_example_LDFLAGS = \
+ -L$(top_srcdir)/src/
+
+vcard_example_LDADD = \
+ $(GLIB_LIBS) \
+ -lvCard
--- /dev/null
+# include <vcard.h>
+
+int main() {
+ return 0;
+}
@GLIB_CFLAGS@ \
-I $(top_srcdir)
-lib_LTLIBRARIES = libvcard.la
+lib_LTLIBRARIES = libvCard.la
-libvcard_la_SOURCES = \
- vcard.c
+libvCard_la_SOURCES = \
+ vcard.c \
+ vcard-parser.h
-libvcard_la_LDFLAGS = \
+libvCard_la_LDFLAGS = \
-version-info @LIB_VERSION@
include_HEADERS = \
vcard.h
-libvcard_la_LIBADD = \
+libvCard_la_LIBADD = \
@GLIB_LIBS@
-if BUILD_EXAMPLE
-bin_PROGRAMS = vcard-example
-vcard_example_SOURCES = vcard-example.c
-vcard_example_LDADD = libvcard.la
-endif
-
--- /dev/null
+/*
+ * vcard-parser.h
+ *
+ * Copyright 2019 Michael Rasmussen <mir@datanom.net>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef __VCARD_H__
+#define __VCARD_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ // vCard 2.1 properties and up
+ N = 0,
+ FN,
+ PHOTO,
+ BDAY,
+ ADR,
+ LABEL, // Removed in vCard 4.0
+ TEL,
+ EMAIL,
+ MAILER, // Removed in vCard 4.0
+ GEO,
+ TITLE,
+ ROLE,
+ LOGO,
+ ORG,
+ NOTE,
+ REV,
+ SOUND,
+ URL,
+ UID,
+ VERSION,
+ KEY,
+ TZ,
+ // vCard 3.0 properties
+ CATEGORIES,
+ SORT_STRING,
+ PRODID,
+ NICKNAME,
+ CLASS, // Removed in vCard 4.0
+ // rfc2739 properties
+ FBURL,
+ CAPURI,
+ CALURI,
+ CALADRURI,
+ // rfc4770 properties
+ IMPP,
+ // vCard 4.0 properties
+ SOURCE,
+ XML,
+ ANNIVERSARY,
+ CLIENTPIDMAP,
+ LANG,
+ GENDER,
+ KIND,
+ MEMBER,
+ RELATED,
+ // rfc6474 properties
+ BIRTHPLACE,
+ DEATHPLACE,
+ DEATHDATE,
+ // rfc6715 properties
+ EXPERTISE,
+ HOBBY,
+ INTEREST,
+ ORG_DIRECTORY,
+ VCARD_PROPERTIES,
+} Property;
+
+gchar* Proterties[VCARD_PROPERTIES+1] = {
+ "N",
+ "FN",
+ "PHOTO",
+ "BDAY",
+ "ADR",
+ "LABEL",
+ "TEL",
+ "EMAIL",
+ "MAILER",
+ "GEO",
+ "TITLE",
+ "ROLE",
+ "LOGO",
+ "ORG",
+ "NOTE",
+ "REV",
+ "SOUND",
+ "URL",
+ "UID",
+ "VERSION",
+ "KEY",
+ "TZ",
+ "CATEGORIES",
+ "SORT-STRING",
+ "PRODID",
+ "NICKNAME",
+ "CLASS",
+ "FBURL",
+ "CAPURI",
+ "CALURI",
+ "CALADRURI",
+ "IMPP",
+ "SOURCE",
+ "XML",
+ "ANNIVERSARY",
+ "CLIENTPIDMAP",
+ "LANG",
+ "GENDER",
+ "KIND",
+ "MEMBER",
+ "RELATED",
+ "BIRTHPLACE",
+ "DEATHPLACE",
+ "DEATHDATE",
+ "EXPERTISE",
+ "HOBBY",
+ "INTEREST",
+ "ORG-DIRECTORY",
+ NULL
+};
+
+G_END_DECLS
+
+gboolean vcard_parse_text();
+
+#endif
+/*
+ * vcard.c
+ *
+ * Copyright 2019 Michael Rasmussen <mir@datanom.net>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+# include <vcard.h>
+
+struct _VCard {
+ gchar *version;
+};
+
+int main() {
+ return 0;
+}
+/*
+ * vcard.h
+ *
+ * Copyright 2019 Michael Rasmussen <mir@datanom.net>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef __VCARD_PARSER_H__
+#define __VCARD_PARSER_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+#include <stdio.h>
+#include <vcard-parser.h>
+
+typedef enum {
+ DETECT,
+ VERSION_2_1,
+ VERSION_3_0,
+ VERSION_4_0,
+} VCardVersion;
+
+typedef struct _VCard VCard;
+
+VCard* VCard_new(VCardVersion version);
+VCard* VCard_new_from_text(const gchar* text, VCardVersion version);
+VCard* VCard_new_from_file(FILE* file, VCardVersion version);
+void VCard_print(VCard* object);
+void VCard_print_fd(VCard* object, int fd);
+
+G_END_DECLS
+
+#endif