-
Notifications
You must be signed in to change notification settings - Fork 0
/
citeme_provide.c
91 lines (73 loc) · 1.87 KB
/
citeme_provide.c
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
/* just uncomment the following #define in order to stop providing any citation data: */
/* #define NO_CITATION_DATA */
#include <citeme.h>
#include <stdio.h>
/* _local_ library citation data */
static const CitationStruct _about =
{
"mylib", /* SW name */
"0.0", /* SW version */
"BSD", /* SW license */
"Oleksandr", /* SW authors */
"\n\n\nHi, this is an example library, which wants some credits...\nHave Fun!\n\n", /* SW banner */
"@article{CITETHIS,title={Citeme for Math. SW},year={2011},author = {O.Motsak}}" /* Bibitem */
};
/* _local_ library citation data (available via a banner) */
static const char* _banner( const BannerType _type )
{
switch (_type)
{
case GetName:
{
return _about.name;
break;
}
case GetAuthors:
{
return _about.authors;
break;
}
case GetBannerMessage:
{
return _about.banner;
break;
}
case GetBibItem:
{
return _about.bibitem;
break;
}
default:
{
return NULL;
break;
}
}
}
/** Please call the following init function for setting things up... */
int initme()
{
CitationError ret;
/* case 1 */
printf("Trying to cite with a struct: \n");
ret = RegisterCitation(ViaStuct, &_about);
if( ret >= Ok )
printf("Fine citation....!\n");
else
printf("Bad citation.... (error code: %d)\n", ret);
/* case 2 */
printf("Trying to cite with a banner: \n");
ret = RegisterCitation(ViaBanner, &_banner);
if( ret >= Ok )
printf("Fine citation....!\n");
else
printf("Bad citation.... (error code: %d)\n", ret);
/* case 3 */
printf("Trying to cite in some otherway: \n");
ret = RegisterCitation(Otherwise);
if( ret >= Ok )
printf("Fine citation....!\n");
else
printf("Bad citation.... (error code: %d)\n", ret);
return ret;
}