working demo

This commit is contained in:
anon 2023-03-13 10:35:02 +01:00
parent 43d1c4a1ce
commit fd8bdecb53
6 changed files with 1846 additions and 1817 deletions

BIN
FIGlib-test Executable file

Binary file not shown.

View File

@ -54,7 +54,7 @@
#define DEFAULTFONTDIR "fonts"
#endif
#ifndef DEFAULTFONTFILE
#define DEFAULTFONTFILE "standard.flf"
#define DEFAULTFONTFILE "standard"
#endif
#include <stdio.h>
@ -927,32 +927,11 @@ void getparams()
int columns,infoprint;
char *controlname,*env;
if ((myname = strrchr(Myargv[0],DIRSEP))!=NULL) {
myname++;
}
else {
myname = Myargv[0];
}
fontdirname = DEFAULTFONTDIR;
env = getenv("FIGLET_FONTDIR");
if (env!=NULL) {
fontdirname = env;
}
fontname = DEFAULTFONTFILE;
cfilelist = NULL;
cfilelistend = &cfilelist;
commandlist = NULL;
commandlistend = &commandlist;
smushoverride = SMO_NO;
deutschflag = 0;
justification = -1;
right2left = -1;
paragraphflag = 0;
infoprint = -1;
cmdinput = 0;
outputwidth = DEFAULTCOLUMNS;
gn[1] = 0x80;
gr = 1;
while ((c = getopt(Myargc,Myargv,"ADEXLRI:xlcrpntvm:w:d:f:C:NFskSWo"))!= -1) {
/* Note: -F is not a legal option -- prints a special err message. */
switch (c) {
@ -1100,7 +1079,6 @@ void getparams()
}
}
if (optind!=Myargc) cmdinput = 1; /* force cmdinput if more arguments */
outlinelenlimit = outputwidth-1;
if (infoprint>=0) {
printinfo(infoprint);
exit(0);
@ -2000,12 +1978,43 @@ inchr getinchr()
}
}
void fig_init(argc, argv)
int argc;
char** argv;
{
Myargc = argc;
Myargv = argv;
if ((myname = strrchr(Myargv[0],DIRSEP))!=NULL) {
myname++;
}
else {
myname = Myargv[0];
}
fontdirname = DEFAULTFONTDIR;
fontname = DEFAULTFONTFILE;
cfilelist = NULL;
cfilelistend = &cfilelist;
commandlist = NULL;
commandlistend = &commandlist;
smushoverride = SMO_NO;
deutschflag = 0;
justification = -1;
right2left = -1;
paragraphflag = 0;
cmdinput = 0;
outputwidth = DEFAULTCOLUMNS;
gn[1] = 0x80;
gr = 1;
outlinelenlimit = outputwidth-1;
}
void f(c)
inchr c;
const inchr c;
{
int i;
int char_not_added;
int wordbreakmode = 0;
static int wordbreakmode = 0;
do {
char_not_added = 0;
@ -2069,8 +2078,14 @@ inchr c;
}
} while (char_not_added);
}
if (outlinelen!=0) {
printline();
void fs(string)
char* string;
{
char* str_ptr = string;
while(*str_ptr!=0){
f(*str_ptr);
++str_ptr;
}
}

View File

@ -54,7 +54,8 @@ DEFAULTFONTFILE = standard
VERSION = 2.2.5
DIST = figlet-$(VERSION)
OBJS = figlet.o zipio.o crc.o inflate.o utf8.o
LIBOBJS = zipio.o crc.o inflate.o utf8.o
OBJS = $(LIBOBJS) figlet.o
BINS = figlet chkfont figlist showfigfonts
MANUAL = figlet.6 chkfont.6 figlist.6 showfigfonts.6
DFILES = Makefile Makefile.tc $(MANUAL) $(OBJS:.o=.c) chkfont.c getopt.c \
@ -70,6 +71,11 @@ all: $(BINS)
figlet: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS)
figlib: $(LIBOBJS)
$(CC) -shared -o libfiglib.so $(LIBOBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -I /home/anon/Swap/figlet/ -L /home/anon/Swap/figlet/ \
tests/FIGlib.c -o FIGlib-test -lfiglib
chkfont: chkfont.o
$(LD) $(LDFLAGS) -o $@ chkfont.o

View File

@ -16,11 +16,9 @@ int argc;
char *argv[];
{
inchr c,c2;
int i;
int last_was_eol_flag;
Myargc = argc;
Myargv = argv;
fig_init(argc, argv);
getparams();
readcontrolfiles();
readfont();
@ -58,7 +56,11 @@ char *argv[];
if ((c>'\0' && c<' ' && c!='\n') || c==127) continue;
f(c);
}
if (outlinelen!=0) {
printline();
}
return 0;
}

BIN
libfiglib.so Executable file

Binary file not shown.

View File

@ -7,8 +7,14 @@ char *argv[];
{
//fontinfo fi;
//readfont(&fi);
fig_init();
fontdirname = "fonts/";
readcontrolfiles();
readfont();
inchrline = "test";
linealloc();
fs("Hello ");
fs("World!");
printline();
return 0;
}