; ; XData2Cat V2.0 ; ; New release !! 18/12/97 ; ; The easy way to make a 'catalog description' file ; from a 'data' file .... ; ; by Xavier NUEL ; ; 1997 BadDolls Production ; ; E-Mail : xn.baddolls@a2points.com ; Homepage : www.a2points.com/homepage/3698138 ; ; Be FREE to do what you want ; with this source... WBStartup NoCli WbToScreen 0 ShowScreen 0 ;------------------------------------- ; / Using Default Font from Workbench ;------------------------------------- FontHeight=8 If OpenFontPrefs Font$=DefaultFontName(1)+".font" FontHeight=DefaultFontHeight(1) CloseFontPrefs If Exists("Fonts:"+Font$) LoadFont 0,Font$,FontHeight EndIf EndIf ;------------------------------------- ; / Def Some Var ;------------------------------------- MaxLen LSNom$=108 *s.Screen=Peek.l(Addr Screen(0)) SWidth=*s\Width SHeight=*s\Height W_Win=-(SWidth<500)*(SWidth-50)-(SWidth>500)*500 H_Win=220 NEWTYPE.value num.w s.s End NEWTYPE Dim Text$(45) Dim Contenu$(1000) Dim List Liste.value(1000) While AddItem(Liste()) Liste()\num=a,"" a+1 Wend ;Donnees fixes ; Contenu$(0)="; Process with XData2Cat V2.0" Contenu$(1)="; ---------" Contenu$(2)="; (c) 1997 Xavier NUEL" Contenu$(3)="; ---------------------------" Contenu$(4)=";" ;## version " Contenu$(5)=";" ;## codeset 0" Contenu$(6)=";" ;## language " #deb=7 Version.l=1 Revision.l=0 ;------------------------------------- ; / Open Locale Catalog ;------------------------------------- *XCat=OpenCatalogA_(0,"XDat2Cat.catalog",0) If *XCat Gosub Localise CloseCatalog_(*XCat) Else Gosub Datalise EndIf ;------------ ;------------------------------------- ; / Encore Quelques Variables... ;------------------------------------- WinTitle$="XData2Cat V2.0" ScrTitle$="XData2Cat V2.0 "+Text$(0) GTGZZPosition On GTButton 0,0,5,4,84,13,"Data",$10 GTButton 0,1,90,4,84,13,".cd",$10 GTButton 0,2,175,4,84,13,".ct",$10 GTText 0,3,3,19,W_Win-16,13,"",$0,"" GTText 0,4,3,189,W_Win-16,13,"",$0,"" GTListView 0,5,3,35,W_Win-16,147,"",1,Liste() DefaultIDCMP $024C077E Window 0,(SWidth-W_Win)/2,(SHeight-H_Win)/2,W_Win,H_Win,$200140E,"",1,2 WTitle WinTitle$,ScrTitle$ AttachGTList 0,0 GTMenuTitle 0,0,Text$(1) GTMenuItem 0,0,0,0,Text$(2),"l" GTMenuItem 0,0,0,1,Text$(3) GTMenuItem 0,0,0,2,Text$(4) GTMenuItem 0,0,0,3,Text$(32) GTMenuItem 0,0,0,4 GTMenuItem 0,0,0,5,Text$(5) GTMenuItem 0,0,0,6,Text$(6),"q" GTMenuTitle 0,1,Text$(34) GTMenuItem 0,0,1,0,Text$(35) GTMenuItem 0,0,1,1,Text$(36) GTMenuItem 0,0,1,2,Text$(37) CreateMenuStrip 0 Use Window 0 CatchDosErrs GTSetMenu 0 GTSetString 0,4,Text$(7) Repeat ev.l=WaitEvent If ev=$40 AND commence Select GadgetHit Case 0 Gosub _Aff_Data Case 1 If commence Then Gosub _Aff_Cd Case 2 If commence Then Gosub _Aff_Ct End Select EndIf If ev=$100 If MenuHit=0 Select ItemHit Case 0 Gosub _Read Case 1 If commence Then Gosub _SaveCd Case 2 If commence Then Gosub _SaveCt Case 3 If commence Then Gosub _SaveCatalog Case 5 About$=Text$(23)+Chr$(10) About$+Text$(22)+Chr$(10) About$+Text$(23)+Chr$(10) About$+Text$(24)+Chr$(10) About$+Text$(25)+Chr$(10) About$+Text$(23)+Chr$(10) About$+Text$(26)+Chr$(10) About$+Text$(27)+Chr$(10) About$+Text$(28)+Chr$(10) About$+Text$(25)+Chr$(10) About$+Text$(29)+Chr$(10) About$+Text$(30)+Chr$(10) Req=RTEZRequest(Text$(5),About$,Text$(17),2,0,4) Case 6 Gosub Quit End Select EndIf If MenuHit=1 If commence If ItemHit=0 Version.l=RTEZGetLong(Text$(35),Text$(38)) EndIf If ItemHit=1 Revision.l=RTEZGetLong(Text$(36),Text$(39)) EndIf If ItemHit=2 Language$=RTEZGetString(Text$(37),Text$(40),20) EndIf EndIf EndIf EndIf If ev=$200 Gosub Quit EndIf Until Quit ; DetachGTList 0 CloseWindow 0 Free GTList 0 Forbid_ End .Quit Req=RTEZRequest(Text$(8),Text$(9),Text$(10),2,0,4) If Req Quit=True End If Return ;______________ ;-------------- ._Read File_$=RTEZLoadFile(Text$(11),LSNom$) If Exists(File_$) If OpenFile (0,File_$) FileInput 0 f=#deb GTSetString 0,3,File_$ GTSetString 0,4,Text$(12) While NOT Eof(0) Contenu$(f)=Edit$(256) f+1 Wend f-1 CloseFile 0 GTSetString 0,4,Text$(13) commence=1 Gosub _Aff_Data DefaultInput Else Req=RTEZRequest(Text$(14),Text$(15)+File_$,Text$(17)) EndIf Else Req=RTEZRequest(Text$(14),Text$(16),Text$(17)) EndIf Return ._Aff_Data GTChangeList 0,5 For j=0 To 1000 Liste(j)\num=j,"" Next For j=0 To f Liste(j)\num=j,Contenu$(j) Next GTChangeList 0,5,Liste() Return ._Aff_Cd GTChangeList 0,5 For j=#deb To 1000 Liste(j)\num=j,"" Next a=1 b=0 Liste(4)\num=4,";" Liste(5)\num=5,";" Liste(6)\num=6,";" c=#deb For j=#deb To f If Left$(Contenu$(j),5)<>"Data$" ; ; c'est un label ; Gosub _Find_Label EndIf If Left$(Contenu$(j),5)="Data$" ; ; c'est un data ; Pos=0 Gosub _Find_Text Liste(c )\num=c ,";" Liste(c+1)\num=c+1,Lab$+Str$(a)+" (//)" Liste(c+2)\num=c+2,Txt$ a+1 b+1 c+3 EndIf Next last_cd=c-1 GTChangeList 0,5,Liste() Return ._Aff_Ct GTChangeList 0,5 For j=#deb To 1000 Liste(j)\num=j,"" Next a=1 VersionString$=Str$(Version)+"." If Revision<10 VersionString$+"0" EndIf VersionString$+Str$(Revision) Version$="## version $VER: "+GetFileName(File_$)+".catalog " Version$+VersionString$+" ("+Date$(SystemDate)+")" Liste(4)\num=4,Version$ Liste(5)\num=5,"## codeset 0" If Language$="" Liste(6)\num=6,"; ## language unknow" Else Liste(6)\num=6,"## language "+Language$ EndIf c=#deb For j=#deb To f If Left$(Contenu$(j),5)<>"Data$" ; ; c'est un label ; Gosub _Find_Label EndIf If Left$(Contenu$(j),5)="Data$" ; ; c'est un data ; Pos=0 Gosub _Find_Text Pos=Instr(Contenu$(j),";",Pos2)+1 Gosub _Find_Text Liste(c )\num=c ,";" Liste(c+1)\num=c+1,Lab$+Str$(a) Liste(c+2)\num=c+2,Txt$ a+1 c+3 EndIf Next last_ct=c-1 GTChangeList 0,5,Liste() Return ._SaveCd Gosub _Aff_Cd LSNom$=GetFileName(File_$)+".cd" FileS_$=RTEZLoadFile(Text$(18),LSNom$) Req=True If Exists(FileS_$) AND FileS_$<>"" Req=RTEZRequest(Text$(19),FileS_$+Chr$(10)+Text$(20),Text$(10),2,0,4) EndIf _SaveCd2 If Req If WriteFile(0,FileS_$) FileOutput 0 For a=0 To last_cd NPrint Liste(a)\s Next CloseFile 0 EndIf GTSetString 0,4,Text$(13) EndIf Return ._SaveCt Gosub _Aff_Ct LSNom$=GetFileName(File_$)+".ct" FileS_$=RTEZLoadFile(Text$(21),LSNom$) Req=True If Exists(FileS_$) AND FileS_$<>"" Req=RTEZRequest(Text$(19),FileS_$+Chr$(10)+Text$(20),Text$(10),2,0,4) EndIf _SaveCt2 If Req If WriteFile(0,FileS_$) FileOutput 0 For a=0 To last_ct NPrint Liste(a)\s Next CloseFile 0 EndIf GTSetString 0,4,Text$(13) EndIf Return ._SaveCatalog TempXDat2Catcd$="Ram:TempXDat2Cat.cd" Gosub _Aff_Cd FileS_$="Ram:TempXDat2Cat.cd" Req=True Gosub _SaveCd2 TempXDat2Catct$="Ram:TempXDat2Cat.ct" Gosub _Aff_Ct FileS_$="Ram:TempXDat2Cat.ct" Req=True Gosub _SaveCt2 LSNom$=GetFileName(File_$)+".catalog" OldDirectory$=GetPathName(File_$) RTEZSetDefaultDirectory 0,"LOCALE:catalogs/" FileS_$=RTEZLoadFile(Text$(31),LSNom$) RTEZSetDefaultDirectory 0,OldDirectory$ Req=True If Exists(FileS_$) AND FileS_$<>"" Req=RTEZRequest(Text$(19),FileS_$+Chr$(10)+Text$(20),Text$(10),2,0,4) EndIf If Req Command$="C:CatComp "+TempXDat2Catcd$+" "+TempXDat2Catct$ Command$+" CATALOG="+Chr$(34)+FileS_$+Chr$(34)+" NOOPTIM" suc.l=Execute_(Command$,0,0) If suc=0 Req=RTEZRequest(Text$(19),Text$(33)+FileS_$,Text$(17),2,0,4) Else GTSetString 0,4,Text$(13) EndIf EndIf Return ._Find_Label Pos1=Instr(Contenu$(j),";") Pos2=Instr(Contenu$(j)," ") Pos=Min(Pos1,Pos2) If Pos=0 Lab$=Contenu$(j) Else Lab$=StripTrail$(Left$(Contenu$(j),Pos),32) EndIf Lab$="MSG_"+Lab$+"_" a=1 Return ._Find_Text Pos1=Instr(Contenu$(j),Chr$(34),Pos)+1 Pos2=Instr(Contenu$(j),Chr$(34),Pos1) Txt$=Mid$(Contenu$(j),Pos1,Pos2-Pos1) Return .Localise For i=0 To 40 Text$(i)=PeekTo$(GetCatalogStr_(*XCat,i,0),0) Next Return .Datalise Restore Text For i=0 To 40 Read Text$(i) Next Return Text Data$ "by BadDolls Production (1997)" ; "par BadDolls Production (1997)" Data$ "Project" ; "Projet" Data$ "Load Data" ; "Lire Data" Data$ "Save .cd" ; "Sauver .cd" Data$ "Save .ct" ; "Sauver .ct" Data$ "About" ; "A propos" Data$ "Quit" ; "Quitter" Data$ "Ready for working..." ; "Je vous attends" Data$ "Request" ; "Requete" Data$ "Do U really want to quit XDat2Cat ???" ; "Voulez-vous vraiment quitter XDat2Cat ???" Data$ "Yes|No !" ; "Oui|Nooon !!!" Data$ "Loading a Data file" ; "Chargement d'un fichier Data" Data$ "Working..." ; "Je travaille..." Data$ "Status : Ok" ; "Statut : Ok" Data$ "Error !!!" ; "Erreur !!!" Data$ "Unable to Load " ; "Impossible de charger " Data$ "Unable to find this file ?!?!" ; "Impossible de trouver ce fichier ?!?!" Data$ "Ok" ; "Ok" Data$ "Saving as .cd" ; "Sauvegarde fichier .cd" Data$ "Attention !!!" ; "Attention !!!" Data$ " exists, do U want overwrite it ?" ; " existe, voulez-vous le remplacer ?" Data$ "Saving as .ct" ; "Sauvegarde fichier .ct" Data$ "- XDat2Cat V2.0 -" ; "- XDat2Cat V2.0 -" Data$ "-----------------" ; "-----------------" Data$ "By Xavier NUEL" ; "Par Xavier NUEL" Data$ "18/12/1997 BadDolls Production" ; "18/12/1997 BadDolls Production" Data$ "The source of this litle" ; "Le source de ce petit" Data$ "program is on my Web Site ;-)" ; "programme est sur mon site Web ;-)" Data$ "Be free to do what you want with it.." ; "Soyez libre d'en faire ce que vous voulez..." Data$ "E-Mail : xn.baddolls@a2points.com" ; "E-Mail : xn.baddolls@a2points.com" Data$ "Homepage : www.a2points.com/homepage/3698138" ; "Homepage : www.a2points.com/homepage/3698138" Data$ "Saving as .catalog" ; "Sauvegarde fichier .catalog" Data$ "Save .catalog" ; "Sauve .catalog" Data$ "There was a problem when creating " ; "Il y a eu un probleme lors de la creation de " Data$ "Edit" ; "Editer" Data$ "Version" ; "Version" Data$ "Revision" ; "Revision" Data$ "Language" ; "Langue" Data$ "Type the version number..." ; "Entrez le numero de version..." Data$ "Type the revision number..." ; "Entrez le numero de revision..." Data$ "Type the language for the catalog..." ; "Entrez la langue du catalogue..."