1 ; +-----------------+ 2 ; | PureHTML Shared | 3 ; +-----------------+ 4 5 ;- 6 ;- Structures 7 8 Structure PH_CONFIG 9 InFile.s 10 OutFile.s 11 InPath.s 12 LibFile.s 13 OpenDone.i 14 15 Folder.i 16 FullPage.i 17 FontName.s 18 FontSize.i 19 LineNumbers.i 20 BGColor.i 21 LNColor.i 22 IncludeLinks.i 23 TabLength.i 24 HideIDE.i 25 Hidden.i 26 27 SuccessFiles.s 28 FailedFiles.s 29 IOPath.s 30 31 LineCount.i 32 LineTotal.i 33 LineDigits.i 34 EndStructure 35 36 Structure PH_STYLE 37 Color.i 38 Bold.i 39 Italic.i 40 Underline.i 41 Strike.i 42 EndStructure 43 44 45 46 47 48 ;- Constants 49 50 ; Exit Flags 51 Enumeration 52 #PHE_Active = 0 53 #PHE_Quit = 2 54 #PHE_Kill = 4 55 EndEnumeration 56 57 ; File Constants 58 #PH_PrefFile = "PureHTML.ini" 59 #PH_SourcePattern = "PureBasic Code|*.pb;*.pbi|All Files (*.*)|*.*" 60 #PH_OutputPattern = "HTML File|*.htm;*.html|All Files (*.*)|*.*" 61 62 ; Unicode not enabled 63 CompilerIf (#PB_Compiler_Unicode) 64 CompilerError "Unicode is currently not supported" 65 CompilerEndIf 66 67 ; Style IDs 68 Enumeration 69 #PHS_Text 70 #PHS_Keyword 71 #PHS_Comment 72 #PHS_Constant 73 #PHS_String 74 #PHS_Function 75 #PHS_Asm 76 #PHS_Operator 77 #PHS_Structure 78 #PHS_Number 79 #PHS_Pointer 80 #PHS_Separator 81 #PHS_Label 82 #PHS_LineNumber 83 ; 84 #PHS_Count 85 EndEnumeration 86 87 88 89 90 91 92 93 94 95 96 97 ; Style Names 98 Global Dim StyleName.s(#PHS_Count - 1) 99 StyleName( 0) = "Text" 100 StyleName( 1) = "Keyword" 101 StyleName( 2) = "Comment" 102 StyleName( 3) = "Constant" 103 StyleName( 4) = "String" 104 StyleName( 5) = "Function" 105 StyleName( 6) = "ASM" 106 StyleName( 7) = "Operator" 107 StyleName( 8) = "Structure" 108 StyleName( 9) = "Number" 109 StyleName(10) = "Pointer" 110 StyleName(11) = "Separator" 111 StyleName(12) = "Label" 112 StyleName(13) = "Line Numbers" 113 114 ; Style Keywords 115 Global Dim StyleKeyword.s(#PHS_Count - 1) 116 StyleKeyword( 0) = "NormalText" 117 StyleKeyword( 1) = "BasicKeyword" 118 StyleKeyword( 2) = "Comment" 119 StyleKeyword( 3) = "Constant" 120 StyleKeyword( 4) = "String" 121 StyleKeyword( 5) = "PureKeyword" 122 StyleKeyword( 6) = "ASMKeyword" 123 StyleKeyword( 7) = "Operator" 124 StyleKeyword( 8) = "Structure" 125 StyleKeyword( 9) = "Number" 126 StyleKeyword(10) = "Pointer" 127 StyleKeyword(11) = "Separator" 128 StyleKeyword(12) = "Label" 129 StyleKeyword(13) = "LineNumber" 130 131 ; Short Style Names 132 Global Dim StyleRef.s(#PHS_Count - 1) 133 StyleRef( 0) = "s0";"text" 134 StyleRef( 1) = "s1";"keyword" 135 StyleRef( 2) = "s2";"comment" 136 StyleRef( 3) = "s3";"constant" 137 StyleRef( 4) = "s4";"string" 138 StyleRef( 5) = "s5";"function" 139 StyleRef( 6) = "s6";"asm" 140 StyleRef( 7) = "s7";"operator" 141 StyleRef( 8) = "s8";"structure" 142 StyleRef( 9) = "s9";"number" 143 StyleRef(10) = "sA";"pointer" 144 StyleRef(11) = "sB";"separator" 145 StyleRef(12) = "sC";"label" 146 ; 147 StyleRef(#PHS_LineNumber) = "LN" 148 149 ; Style Definitions 150 Global Dim Style.PH_STYLE(#PHS_Count - 1) 151 152 ; Style Default Colors 153 Global Dim DefColor.i(#PHS_Count - 1) 154 DefColor( 0) = $000000 155 DefColor( 1) = $666600 156 DefColor( 2) = $AAAA00 157 DefColor( 3) = $724B92 158 DefColor( 4) = $000000 159 DefColor( 5) = $666600 160 DefColor( 6) = $724B92 161 DefColor( 7) = $000000 162 DefColor( 8) = $000000 163 DefColor( 9) = $000000 164 DefColor(10) = $000000 165 DefColor(11) = $000000 166 DefColor(12) = $000000 167 DefColor(13) = $808080 168 169 170 171 172 173 174 175 176 ;- OS-Dependent 177 178 CompilerSelect (#PB_Compiler_OS) 179 CompilerCase (#PB_OS_Windows) 180 #PH_IconError = #MB_ICONHAND 181 #PH_IconWarn = #MB_ICONWARNING 182 #PH_IconInfo = #MB_ICONINFORMATION 183 #PS$ = "\" 184 185 Macro WLMO(Windows, Linux, Mac, Other) 186 Windows 187 EndMacro 188 189 CompilerCase (#PB_OS_MacOS) 190 #PH_IconError = #Null 191 #PH_IconWarn = #Null 192 #PH_IconInfo = #Null 193 #PS$ = "/" 194 195 Macro WLMO(Windows, Linux, Mac, Other) 196 Mac 197 EndMacro 198 199 CompilerDefault 200 CompilerError "This OS is not yet supported" 201 CompilerEndSelect 202 203 204 205 206 207 208 ;- Variables 209 210 EnableExplicit 211 212 Global ExitFlag.i = #PHE_Active 213 Global Config.PH_CONFIG 214 Define Event.i 215 216 217 218 219 220 221 ;- 222 ;- Macros 223 224 Macro Warn(Message) 225 MessageRequester(#PH_Title, Message, #PH_IconWarn) 226 EndMacro 227 Macro Info(Message) 228 MessageRequester(#PH_Title, Message, #PH_IconInfo) 229 EndMacro 230 231 232 ;- 233 ;- Procedures 234 235 Procedure Shutdown(ExitCode.i = 0) 236 End ExitCode 237 EndProcedure 238 239 Procedure Error(Message.s) 240 MessageRequester(#PH_Title + " - Error", Message, #PH_IconError) 241 Shutdown(1) 242 EndProcedure 243 244 Procedure.s VersionString(Number.i) 245 Protected Result.s 246 247 If (Number > 0) 248 Result = StrF(Number * 0.01, 2) 249 Else 250 Result = "?" 251 EndIf 252 253 ProcedureReturn (Result) 254 EndProcedure 255 256 Procedure About() 257 Protected St.s 258 St = #PH_Title + #LF$ + "Version " + VersionString(#PH_Version) 259 St + #LF$ + " by " + #PH_Author + #LF$ + " " + #PH_Website 260 Info(St) 261 EndProcedure 262 263 ;- Declares 264 265 Declare.i TryHighlight() 266 Declare.i TryImport() 267 Declare.i TryExport() 268 269 ;- 270 ; EOF