Add rayman2 source files
This commit is contained in:
88
Rayman_X/cpa/IA - HELP/RTFIndex/VC/RTFIndex.dsp
Normal file
88
Rayman_X/cpa/IA - HELP/RTFIndex/VC/RTFIndex.dsp
Normal file
@@ -0,0 +1,88 @@
|
||||
# Microsoft Developer Studio Project File - Name="VC" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 5.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=VC - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "RTFIndex.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "RTFIndex.mak" CFG="VC - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "VC - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "VC - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "VC - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40c /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "VC - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W4 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c
|
||||
# ADD BASE RSC /l 0x40c /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "VC - Win32 Release"
|
||||
# Name "VC - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\rtfindex.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
29
Rayman_X/cpa/IA - HELP/RTFIndex/VC/RTFIndex.dsw
Normal file
29
Rayman_X/cpa/IA - HELP/RTFIndex/VC/RTFIndex.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 5.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "VC"=.\VC.DSP - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
BIN
Rayman_X/cpa/IA - HELP/RTFIndex/VC/RTFIndex.opt
Normal file
BIN
Rayman_X/cpa/IA - HELP/RTFIndex/VC/RTFIndex.opt
Normal file
Binary file not shown.
5
Rayman_X/cpa/IA - HELP/RTFIndex/VC/mssccprj.scc
Normal file
5
Rayman_X/cpa/IA - HELP/RTFIndex/VC/mssccprj.scc
Normal file
@@ -0,0 +1,5 @@
|
||||
SCC = This is a Source Code Control file
|
||||
|
||||
[RTFIndex.dsp]
|
||||
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
|
||||
SCC_Project_Name = "$/CPA/IA - HELP/RTFIndex/VC", WRIAAAAA
|
2
Rayman_X/cpa/IA - HELP/RTFIndex/WC/RTFINDEX.LK1
Normal file
2
Rayman_X/cpa/IA - HELP/RTFIndex/WC/RTFINDEX.LK1
Normal file
@@ -0,0 +1,2 @@
|
||||
FIL rtfindex.obj
|
||||
|
3
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.mk
Normal file
3
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.mk
Normal file
@@ -0,0 +1,3 @@
|
||||
project : d:\myacp\oac\help\rtfindex\wc\rtfindex.exe .SYMBOLIC
|
||||
|
||||
!include d:\myacp\oac\help\rtfindex\wc\rtfindex.mk1
|
24
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.mk1
Normal file
24
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.mk1
Normal file
@@ -0,0 +1,24 @@
|
||||
!define BLANK ""
|
||||
d:\myacp\oac\help\rtfindex\wc\rtfindex.obj : d:\myacp\oac\help\rtfindex\rtfi&
|
||||
ndex.c .AUTODEPEND
|
||||
@d:
|
||||
cd d:\myacp\oac\help\rtfindex\wc
|
||||
*wcc386 ..\rtfindex.c -i=C:\WC\h;C:\WC\h\nt -w4 -e25 -zq -od -d2 -5r -bt=nt&
|
||||
-mf
|
||||
|
||||
d:\myacp\oac\help\rtfindex\wc\rtfindex.exe : d:\myacp\oac\help\rtfindex\wc\r&
|
||||
tfindex.obj .AUTODEPEND
|
||||
@d:
|
||||
cd d:\myacp\oac\help\rtfindex\wc
|
||||
@%write rtfindex.lk1 FIL rtfindex.obj
|
||||
@%append rtfindex.lk1
|
||||
!ifneq BLANK ""
|
||||
*wlib -q -n -b rtfindex.imp
|
||||
@%append rtfindex.lk1 LIBR rtfindex.imp
|
||||
!endif
|
||||
!ifneq BLANK ""
|
||||
@%append rtfindex.lk1 op resource=
|
||||
!endif
|
||||
*wlink name rtfindex d all op inc SYS nt op m op maxe=25 op q op symf @rtfi&
|
||||
ndex.lk1
|
||||
|
131
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.tgt
Normal file
131
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.tgt
Normal file
@@ -0,0 +1,131 @@
|
||||
40
|
||||
targetIdent
|
||||
0
|
||||
MProject
|
||||
1
|
||||
MComponent
|
||||
0
|
||||
2
|
||||
WString
|
||||
4
|
||||
NEXE
|
||||
3
|
||||
WString
|
||||
5
|
||||
nc2en
|
||||
1
|
||||
0
|
||||
1
|
||||
4
|
||||
MCommand
|
||||
0
|
||||
5
|
||||
MCommand
|
||||
0
|
||||
6
|
||||
MItem
|
||||
12
|
||||
rtfindex.exe
|
||||
7
|
||||
WString
|
||||
4
|
||||
NEXE
|
||||
8
|
||||
WVList
|
||||
0
|
||||
9
|
||||
WVList
|
||||
2
|
||||
10
|
||||
ActionStates
|
||||
11
|
||||
WString
|
||||
6
|
||||
&Debug
|
||||
12
|
||||
WVList
|
||||
1
|
||||
13
|
||||
MVState
|
||||
14
|
||||
WString
|
||||
6
|
||||
WDEBUG
|
||||
15
|
||||
WString
|
||||
28
|
||||
?????Application parameters:
|
||||
1
|
||||
16
|
||||
WString
|
||||
56
|
||||
RTFFILES\CONDS.RTF "Les fonctions de condition" RTFFILES
|
||||
0
|
||||
17
|
||||
ActionStates
|
||||
18
|
||||
WString
|
||||
4
|
||||
&Run
|
||||
19
|
||||
WVList
|
||||
1
|
||||
20
|
||||
MVState
|
||||
21
|
||||
WString
|
||||
3
|
||||
RUN
|
||||
22
|
||||
WString
|
||||
28
|
||||
?????Application parameters:
|
||||
1
|
||||
23
|
||||
WString
|
||||
56
|
||||
RTFFILES\CONDS.RTF "Les fonctions de condition" RTFFILES
|
||||
0
|
||||
-1
|
||||
1
|
||||
1
|
||||
0
|
||||
24
|
||||
WPickList
|
||||
2
|
||||
25
|
||||
MItem
|
||||
3
|
||||
*.c
|
||||
26
|
||||
WString
|
||||
4
|
||||
COBJ
|
||||
27
|
||||
WVList
|
||||
0
|
||||
28
|
||||
WVList
|
||||
0
|
||||
-1
|
||||
1
|
||||
1
|
||||
0
|
||||
29
|
||||
MItem
|
||||
13
|
||||
..\rtfindex.c
|
||||
30
|
||||
WString
|
||||
4
|
||||
COBJ
|
||||
31
|
||||
WVList
|
||||
0
|
||||
32
|
||||
WVList
|
||||
0
|
||||
25
|
||||
1
|
||||
1
|
||||
0
|
43
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.wpj
Normal file
43
Rayman_X/cpa/IA - HELP/RTFIndex/WC/rtfindex.wpj
Normal file
@@ -0,0 +1,43 @@
|
||||
40
|
||||
projectIdent
|
||||
0
|
||||
VpeMain
|
||||
1
|
||||
WRect
|
||||
760
|
||||
120
|
||||
7770
|
||||
9480
|
||||
2
|
||||
MProject
|
||||
3
|
||||
MCommand
|
||||
0
|
||||
4
|
||||
MCommand
|
||||
0
|
||||
1
|
||||
5
|
||||
WFileName
|
||||
12
|
||||
rtfindex.tgt
|
||||
6
|
||||
WVList
|
||||
1
|
||||
7
|
||||
VComponent
|
||||
8
|
||||
WRect
|
||||
0
|
||||
0
|
||||
5700
|
||||
4280
|
||||
0
|
||||
0
|
||||
9
|
||||
WFileName
|
||||
12
|
||||
rtfindex.tgt
|
||||
0
|
||||
1
|
||||
7
|
238
Rayman_X/cpa/IA - HELP/RTFIndex/rtfindex.c
Normal file
238
Rayman_X/cpa/IA - HELP/RTFIndex/rtfindex.c
Normal file
@@ -0,0 +1,238 @@
|
||||
/************************************************************/
|
||||
/* RTFIndex v2.0 by Olivier Couvreur */
|
||||
/* A WIN32 console application for building Index RTF files */
|
||||
/* supports both WC 11.0 and VC 5.0 compiler */
|
||||
/************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <conio.h>
|
||||
|
||||
#define NAME "RTFIndex"
|
||||
#define VERSION "2.0"
|
||||
#define AUTHOR "Olivier Couvreur"
|
||||
|
||||
/* some macros in order to compile under WC 11.0 or VC 5.0 */
|
||||
#if defined(__WATCOMC__)
|
||||
#include <dos.h>
|
||||
#define M_INITFIND
|
||||
#define M_FINDFIRST(a,b,c) (!_dos_findfirst(a,b,c))
|
||||
#define M_FINDNEXT(c) _dos_findnext(c)
|
||||
#define M_FINDCLOSE(c) _dos_findclose(c)
|
||||
#define M_FINDDATA find_t
|
||||
#else
|
||||
#include <io.h>
|
||||
#define M_INITFIND long findhandle=-1L;
|
||||
#define M_FINDFIRST(a,b,c) ((findhandle=_findfirst(a,c))!=-1L)
|
||||
#define M_FINDNEXT(c) _findnext(findhandle,c)
|
||||
#define M_FINDCLOSE(a) _findclose(findhandle)
|
||||
#define M_FINDDATA _finddata_t
|
||||
#endif
|
||||
|
||||
/* The magic header */
|
||||
char RTFHeader[]=
|
||||
"{\\rtf1\\ansi\\ansicpg1252\\uc1 \\deff0\\deflang1033\\deflangfe1036{\\fonttbl{\\f0\\froman\\fcharset0\\fprq2{\\*\\panose 02020603050405020304}Times New Roman;}{\\f17\\froman\\fcharset238\\fprq2 Times New Roman CE;}{\\f18\\froman\\fcharset204\\fprq2 Times New Roman Cyr;}"
|
||||
"{\\f20\\froman\\fcharset161\\fprq2 Times New Roman Greek;}{\\f21\\froman\\fcharset162\\fprq2 Times New Roman Tur;}{\\f22\\froman\\fcharset186\\fprq2 Times New Roman Baltic;}}{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue255;"
|
||||
"\\red0\\green255\\blue0;\\red255\\green0\\blue255;\\red255\\green0\\blue0;\\red255\\green255\\blue0;\\red255\\green255\\blue255;\\red0\\green0\\blue128;\\red0\\green128\\blue128;\\red0\\green128\\blue0;\\red128\\green0\\blue128;\\red128\\green0\\blue0;\\red128\\green128\\blue0;"
|
||||
"\\red128\\green128\\blue128;\\red192\\green192\\blue192;}{\\stylesheet{\\widctlpar\\adjustright \\fs20\\lang1036 \\snext0 Normal;}{\\s4\\fi-284\\li284\\sb240\\sa60\\widctlpar\\adjustright \\b\\i\\cf2\\lang2057 \\sbasedon0 \\snext0 heading 4;}{\\*\\cs10 \\additive "
|
||||
"Default Paragraph Font;}{\\s15\\widctlpar\\adjustright \\fs20\\lang1036 \\sbasedon0 \\snext15 footnote text;}{\\*\\cs16 \\additive \\super \\sbasedon10 footnote reference;}{\\s17\\keepn\\widctlpar\\adjustright \\b\\fs28\\cf11\\lang1036 \\sbasedon0 \\snext17 Title;}{"
|
||||
"\\s18\\widctlpar\\tqc\\tx4536\\tqr\\tx9072\\adjustright \\fs20\\lang1036 \\sbasedon0 \\snext18 header;}{\\s19\\widctlpar\\tqc\\tx4536\\tqr\\tx9072\\adjustright \\fs20\\lang1036 \\sbasedon0 \\snext19 footer;}{\\*\\cs20 \\additive \\uldb\\nosupersub Lien;}{\\*\\cs21 \\additive "
|
||||
"\\v\\ulnone\\nosupersub R\\'e9f\\'e9rence;}}{\\info{\\title K$ Nom de la M\\'e9taAction}{\\author Xavier Billault}{\\keywords %s}{\\operator Yves BABITCH}{\\creatim\\yr1997\\mo3\\dy19\\hr9\\min34}{\\revtim\\yr1998\\mo7\\dy23\\hr12\\min5}{\\version12}{\\edmins17}"
|
||||
"{\\nofpages1}{\\nofwords13}{\\nofchars79}{\\*\\company UBI SOFT}{\\nofcharsws0}{\\vern89}}\\margl1417\\margr1417\\margt1417\\margb1417 \\deftab708\\widowctrl\\ftnbj\\aenddoc\\hyphhotz425\\hyphcaps0\\formshade\\viewkind1\\viewscale129\\viewzk2 \\fet0\\sectd "
|
||||
"\\linex0\\headery709\\footery709\\colsx709\\endnhere\\sectdefaultcl {\\*\\pnseclvl1\\pnucrm\\pnstart1\\pnindent720\\pnhang{\\pntxta .}}{\\*\\pnseclvl2\\pnucltr\\pnstart1\\pnindent720\\pnhang{\\pntxta .}}{\\*\\pnseclvl3\\pndec\\pnstart1\\pnindent720\\pnhang{\\pntxta .}}{\\*\\pnseclvl4"
|
||||
"\\pnlcltr\\pnstart1\\pnindent720\\pnhang{\\pntxta )}}{\\*\\pnseclvl5\\pndec\\pnstart1\\pnindent720\\pnhang{\\pntxtb (}{\\pntxta )}}{\\*\\pnseclvl6\\pnlcltr\\pnstart1\\pnindent720\\pnhang{\\pntxtb (}{\\pntxta )}}{\\*\\pnseclvl7\\pnlcrm\\pnstart1\\pnindent720\\pnhang{\\pntxtb (}"
|
||||
"{\\pntxta )}}{\\*\\pnseclvl8\\pnlcltr\\pnstart1\\pnindent720\\pnhang{\\pntxtb (}{\\pntxta )}}{\\*\\pnseclvl9\\pnlcrm\\pnstart1\\pnindent720\\pnhang{\\pntxtb (}{\\pntxta )}}\\pard\\plain \\s17\\keepn\\widctlpar\\adjustright \\b\\fs28\\cf11\\lang1036 {\\cs16\\super #{\\footnote "
|
||||
"\\pard\\plain \\s15\\widctlpar\\adjustright \\fs20\\lang1036 {\\cs16\\super #}{ IDH_}{\\field\\fldedit{\\*\\fldinst { KEYWORDS \\\\* UPPER \\\\* MERGEFORMAT }}{\\fldrslt {%s}}}}K{\\footnote \\pard\\plain \\s15\\widctlpar\\adjustright \\fs20\\lang1036 {\\cs16\\super K}"
|
||||
"{\\field{\\*\\fldinst { KEYWORDS \\\\* MERGEFORMAT }}{\\fldrslt {%s}}}}${\\footnote \\pard\\plain \\s15\\widctlpar\\adjustright \\fs20\\lang1036 {\\cs16\\super $}{ }{\\field{\\*\\fldinst { KEYWORDS \\\\* MERGEFORMAT }}{\\fldrslt {%s}}}}}"
|
||||
"{\\field{\\*\\fldinst { KEYWORDS \\\\* MERGEFORMAT }}{\\fldrslt {%s}}}{\\par }"
|
||||
"\\pard\\plain \\s4\\fi-284\\li284\\sb240\\sa60\\widctlpar\\outlinelevel3\\adjustright \\b\\i\\cf2\\lang2057 "
|
||||
"\\pard\\plain \\widctlpar\\adjustright \\fs20\\lang1036 "
|
||||
"{\\par }";
|
||||
|
||||
char RTFFooter[]=
|
||||
"}\n";
|
||||
|
||||
#define MAX_STRING_SIZE 256
|
||||
#define NB_MAX_RTF 1000
|
||||
typedef struct
|
||||
{
|
||||
char FileName[MAX_STRING_SIZE];
|
||||
char IndexName[MAX_STRING_SIZE];
|
||||
} RTFIndexStruct;
|
||||
|
||||
RTFIndexStruct RTFIndex[NB_MAX_RTF];
|
||||
|
||||
long filesize( FILE *fp )
|
||||
{
|
||||
long save_pos, size_of_file;
|
||||
|
||||
save_pos = ftell( fp );
|
||||
fseek( fp, 0L, SEEK_END );
|
||||
size_of_file = ftell( fp );
|
||||
fseek( fp, save_pos, SEEK_SET );
|
||||
return( size_of_file );
|
||||
}
|
||||
|
||||
/* look for ... string in text "keywords ...}" */
|
||||
void AddRTFFileToIndex(char *directory,RTFIndexStruct *RTFIndex)
|
||||
{
|
||||
FILE *infp;
|
||||
char filename[MAX_STRING_SIZE];
|
||||
char *ptr1,*ptr2;
|
||||
char *mem;
|
||||
long size;
|
||||
char keyword1[]="keywords ";
|
||||
char keyword2[]="}";
|
||||
|
||||
_makepath(filename,NULL,directory,RTFIndex->FileName,NULL);
|
||||
strupr(filename);
|
||||
|
||||
if ((infp=fopen(filename,"r"))!=NULL)
|
||||
{
|
||||
size=filesize(infp);
|
||||
if ((mem=(char*) malloc(size))!=NULL)
|
||||
{
|
||||
fread(mem,size,1,infp);
|
||||
if ((ptr1=strstr(mem,keyword1))!=NULL)
|
||||
{
|
||||
ptr1+=strlen(keyword1);
|
||||
if ((ptr2=strstr(ptr1,keyword2))!=NULL)
|
||||
{
|
||||
*ptr2=0;
|
||||
strcpy(RTFIndex->IndexName,ptr1);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(RTFIndex->IndexName,"Keywords not found");
|
||||
}
|
||||
}
|
||||
free(mem);
|
||||
}
|
||||
fclose(infp);
|
||||
}
|
||||
}
|
||||
|
||||
int CompareIndex(const void *op1, const void *op2 )
|
||||
{
|
||||
RTFIndexStruct *p1 = (RTFIndexStruct *) op1;
|
||||
RTFIndexStruct *p2 = (RTFIndexStruct*) op2;
|
||||
return( strcmp(p1->IndexName, p2->IndexName) );
|
||||
}
|
||||
|
||||
void GenerateRTFIndex(char *file,char *title,char *directory)
|
||||
{
|
||||
FILE *outfp;
|
||||
char completefilename[MAX_STRING_SIZE];
|
||||
char *filename;
|
||||
char pattern[MAX_STRING_SIZE];
|
||||
char supertitle[MAX_STRING_SIZE];
|
||||
char str[MAX_STRING_SIZE];
|
||||
struct M_FINDDATA FINDT;
|
||||
unsigned done=0;
|
||||
char *ptr;
|
||||
long i,n=0;
|
||||
M_INITFIND
|
||||
|
||||
if ((ptr=strrchr(file,'.'))!=NULL) *ptr=0;
|
||||
_makepath(completefilename,NULL,NULL,file,"rtf");
|
||||
strupr(completefilename);
|
||||
|
||||
if ((filename=strrchr(completefilename,'\\'))==NULL)
|
||||
filename=&completefilename[0];
|
||||
else
|
||||
filename++;
|
||||
|
||||
_makepath(pattern,NULL,directory,"*","rtf");
|
||||
strupr(pattern);
|
||||
|
||||
/* find .rtf files in directory */
|
||||
n=0;
|
||||
if (M_FINDFIRST(pattern,_A_NORMAL,&FINDT))
|
||||
{
|
||||
done=0;
|
||||
while ( (!done) && (n<NB_MAX_RTF) )
|
||||
{
|
||||
if (stricmp(filename,FINDT.name))
|
||||
{
|
||||
strcpy(RTFIndex[n].FileName,FINDT.name);
|
||||
printf("Adding file %s to index...\n",RTFIndex[n].FileName);
|
||||
AddRTFFileToIndex(directory,&RTFIndex[n]);
|
||||
n++;
|
||||
}
|
||||
done = M_FINDNEXT(&FINDT);
|
||||
}
|
||||
M_FINDCLOSE(&FINDT);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (n>0)
|
||||
{
|
||||
printf("Sorting index...\n");
|
||||
qsort(&RTFIndex[0],n,sizeof(RTFIndexStruct),CompareIndex);
|
||||
|
||||
printf("Generating index %s ...\n",completefilename);
|
||||
if ((outfp=fopen(completefilename,"w"))!=NULL)
|
||||
{
|
||||
strcpy(supertitle,title);strupr(supertitle);
|
||||
while ((ptr=strchr(supertitle,' '))!=NULL) *ptr='_';
|
||||
|
||||
fprintf(outfp,RTFHeader,title,supertitle,title,title,title);
|
||||
|
||||
for (i=0;i<n;i++)
|
||||
{
|
||||
strcpy(str,RTFIndex[i].IndexName);
|
||||
fprintf(outfp,"{\\uldb %s}",str);
|
||||
strupr(str);
|
||||
fprintf(outfp,"{\\v IDH_%s}{\\par }" "\n",str);
|
||||
}
|
||||
|
||||
fprintf(outfp,"%s",RTFFooter);
|
||||
fclose(outfp);
|
||||
printf("Now, there are %d indexes in %s.\n",n,completefilename);
|
||||
|
||||
/// save list with rtffiles
|
||||
if ((ptr=strrchr(file,'.'))!=NULL) *ptr=0;
|
||||
_makepath(completefilename,NULL,NULL,file,"txt");
|
||||
strupr(completefilename);
|
||||
|
||||
printf("Generating rtf listing %s ...\n",completefilename);
|
||||
if ((outfp=fopen(completefilename,"w"))!=NULL)
|
||||
{
|
||||
for (i=0;i<n;i++)
|
||||
{
|
||||
fprintf(outfp,"%s\n",RTFIndex[i].IndexName);
|
||||
}
|
||||
fclose(outfp);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Can't open %s for writing\n.",completefilename);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("No RTF files in these directory.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void main(int argc,char *argv[])
|
||||
{
|
||||
printf("%s v%s by %s (%s %s)\n\n",NAME,VERSION,AUTHOR,__DATE__,__TIME__);
|
||||
if (argc==3)
|
||||
{
|
||||
GenerateRTFIndex(argv[1],argv[2],NULL);
|
||||
}
|
||||
else if (argc==4)
|
||||
{
|
||||
GenerateRTFIndex(argv[1],argv[2],argv[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Usage : %s RTFFileToGenerate[.RTF] \"RTFIndexTitle\" [DirectoryToScan]\n",NAME);
|
||||
printf(" %s MyRTFIndex \"My RTF Title\" MyRTFDir\n",NAME);
|
||||
}
|
||||
getch();
|
||||
}
|
Reference in New Issue
Block a user