{ This file is part of the Free Pascal run time library. Copyright (c) 2022 by the Free Pascal development team Original author: Michael van Canneyt CGI TypeScript definitelytyped to pas2js code generator app See the file COPYING.FPC, included in this distribution, for details about the copyright. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. **********************************************************************} program convcgi; { $DEFINE USEHTTPAPP} uses typinfo, sysutils, classes, cgutils, tstopas, {$IFDEF USEHTTPAPP} fphttpapp{$ELSE} fpcgi {$ENDIF}, httpdefs, httproute; function GetBoolVal(R : TRequest; aName : String) : boolean; Var S : String; begin S:=R.QueryFields.Values[aName]; Result:=(S='1') or (S='true') or (S='t'); end; Procedure CreateJSONFileList(aDir : String; aFileName : string; aTextFileName : String = '' ); Var L,O : TStrings; I : integer; S : String; begin O:=Nil; L:=TStringList.Create; try O:=TstringList.Create; GetDeclarationFileNames(aDir,aDir,L); TstringList(l).Sort; if aTextFileName<>'' then L.SaveToFile(aTextFileName); O.Add('var dtsfiles = ['); for I:=0 to L.Count-1 do begin S:=L[i]; S:=''''+StringReplace(S,'''','''''',[rfReplaceAll])+''''; if I