don't try to link with ssl when testing for connect (unnecessary)
[AROS-Contrib.git] / fish / lyr-o-mat / words_main.c
blob8e517ac67e4d17c785871ccec5ced335e075da40
2 #include "words.h"
4 struct WordsInfo winfo;
5 ULONG NumGen = 1;
6 struct ed edit;
7 long __OSlibversion = 37;
9 struct Library * AslBase;
10 struct GfxBase * GfxBase;
11 struct Library * IconBase;
12 struct IntuitionBase * IntuitionBase;
13 struct UtilityBase * UtilityBase;
14 struct Library * GadToolsBase;
16 BOOL openlibs(void)
18 AslBase = OpenLibrary("asl.library",0);
19 GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0);
20 IconBase = OpenLibrary("icon.library",0);
21 IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
22 UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library",0);
23 GadToolsBase = OpenLibrary("gadtools.library",0);
25 if (!AslBase || !GfxBase || !IconBase || !IntuitionBase || !UtilityBase || !GadToolsBase)
26 return FALSE;
27 return TRUE;
30 void closelibs(void)
32 if (AslBase) CloseLibrary(AslBase);
33 if (GfxBase) CloseLibrary((struct Library *)GfxBase);
34 if (IconBase) CloseLibrary(IconBase);
35 if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
36 if (UtilityBase) CloseLibrary((struct Library *)UtilityBase);
37 if (GadToolsBase) CloseLibrary(GadToolsBase);
41 /* ------------------------------------------------------------------- */
42 /* for cback.o startup */
43 /* ------------------------------------------------------------------- */
45 long __stack = 8192;
46 char *__procname = "*Lyr-O-Mat V1.1*";
47 long __priority = 0L;
48 long __BackGroundIO = 0;
49 extern BPTR _Backstdout;
51 /* ----------------------------------------------------------------- */
54 int main(int argc, char **argv)
56 int end = FALSE;
57 time(&RangeSeed);
59 if (openlibs())
61 if(!SetupScreen())
63 if(!OpenProject0Window())
65 NewList(&winfo.pattern);
66 NewList(&winfo.class);
67 edit.pattern = 0;
68 edit.class = 0;
69 edit.word = 0;
70 edit.l_p = 1;
71 edit.l_c = 1;
72 edit.writeicon = 1;
73 edit.pmode = 1;
74 strcpy(winfo.outfilename,OUTFILENAME);
75 strcpy(winfo.d_dir,"s:");
76 strcpy(winfo.d_name,"Lyr-O-Mat_config.wds");
77 loadAll(MODE_LOADCONFIG,"Loading configfile...");
78 LoadApp(argc,argv);
79 winfo.outfile = fopen(winfo.outfilename,"w");
80 strcpy(winfo.l_dir,"");
81 strcpy(winfo.l_name,"unnamed.wds");
82 strcpy(winfo.s_dir,"");
83 strcpy(winfo.s_name,"unnamed.wds");
84 strcpy(winfo.d_dir,"");
85 strcpy(winfo.d_name,"unnamed.wds");
86 while(!end)
88 WaitPort(Project0Wnd->UserPort);
89 end = !HandleProject0IDCMP();
91 if(winfo.outfile) fclose(winfo.outfile);
92 if(winfo.printfile)fclose(winfo.printfile);
93 delAll();
94 CloseProject0Window();
96 CloseDownScreen();
99 closelibs();
100 exit(0);
103 void LoadApp(int argc,char **argv)
105 struct DiskObject *dobj;
106 UBYTE *tool;
107 long i;
108 if(!argc)
110 struct WBStartup *msg = (struct WBStartup *)argv;
111 if(msg)
113 if(msg->sm_NumArgs > 1)
115 for(i = 1; i < msg->sm_NumArgs;i++)
117 NameFromLock(msg->sm_ArgList[i].wa_Lock,winfo.d_dir,256);
118 strcpy(winfo.d_name,msg->sm_ArgList[i].wa_Name);
119 loadAll(MODE_LOADCONFIG,"Loading Application...");
123 if((dobj = GetDiskObject(msg->sm_ArgList->wa_Name)))
125 long left = 0L;
126 long top = 50L;
127 long width = 320L;
128 long height = 150L;
129 if((tool = FindToolType(dobj->do_ToolTypes,"LEFTEDGE")))left = atol(tool);
130 if((tool = FindToolType(dobj->do_ToolTypes,"TOPEDGE"))) top = atol(tool);
131 if((tool = FindToolType(dobj->do_ToolTypes,"WIDTH"))) width = atol(tool);
132 if((tool = FindToolType(dobj->do_ToolTypes,"HEIGHT"))) height = atol(tool);
133 left = (left < 0) ? 0 : (left > Scr->Width ) ? Scr->Width : left;
134 top = (top < 0) ? 0 : (top > Scr->Height) ? Scr->Height : top;
135 width = (width > (Scr->Width - left)) ? Scr->Width - left : width;
136 height = (height > (Scr->Height - top)) ? Scr->Height - top : height;
137 sprintf(winfo.outfilename,"con:%ld/%ld/%ld/%ld/" LYR_NAME "/INACTIVE",left,top,width,height);