Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit e1893d6

Browse files
committed
Nifty ISPP macros for automating the scripted constants
1 parent 9dbd239 commit e1893d6

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

ElixirWeb.iss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
#define ERLANG_CSV_URL 'http://elixir-lang.org/erlang.csv'
2323

2424
#include <idp.iss>
25-
26-
#define StrInspectSignature(str Value) 'Const_' + StringChange(Value, '.', '__')
27-
#define StrInspectScriptConst(str Value) '{code:' + StrInspectSignature(Value) + '}'
28-
#define StrInspectFuncDef(str Value) 'function ' + StrInspectSignature(Value) + '(Param: String): String; begin Result := ' + Value + '; end;'
25+
#include "src\ispp_inspect.iss"
2926

3027
[Setup]
3128
AppName=Elixir
@@ -192,9 +189,4 @@ function CheckToInstallErlang: Boolean; begin
192189
function CheckToAddExistingErlangPath: Boolean; begin
193190
Result := (not CheckToInstallErlang) and (not ErlangInPath); end;
194191
195-
{#StrInspectFuncDef('GlobalErlangData.Name32')}
196-
{#StrInspectFuncDef('GlobalErlangData.Name64')}
197-
{#StrInspectFuncDef('GlobalErlangData.Exe32')}
198-
{#StrInspectFuncDef('GlobalErlangData.Exe64')}
199-
{#StrInspectFuncDef('GetLatestErlangPath')}
200-
{#StrInspectFuncDef('CacheSelectedRelease.Version')}
192+
{#StrInspectAllFuncs}

src/ispp_inspect.iss

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; ispp_inspect.iss - ISPP macros for scripted constants to inspect any arbitrary value
2+
; Copyright 2014 Chris Hyndman
3+
;
4+
; Licensed under the Apache License, Version 2.0 (the "License");
5+
; you may not use this file except in compliance with the License.
6+
; You may obtain a copy of the License at
7+
;
8+
; http://www.apache.org/licenses/LICENSE-2.0
9+
;
10+
; Unless required by applicable law or agreed to in writing, software
11+
; distributed under the License is distributed on an "AS IS" BASIS,
12+
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
; See the License for the specific language governing permissions and
14+
; limitations under the License.
15+
16+
#define StrInspectSignature(str Value) 'Const_' + StringChange(Value, '.', '__')
17+
#define StrInspectFuncDef(str Value) 'function ' + StrInspectSignature(Value) + '(Param: String): String; begin Result := ' + Value + '; end; '
18+
19+
#define StrInspectAllFuncs = ''
20+
21+
#define StrInspectScriptConst(str Value) \
22+
Pos(StrInspectFuncDef(Value), StrInspectAllFuncs) == 0 ? \
23+
StrInspectAllFuncs = StrInspectAllFuncs + StrInspectFuncDef(Value) : 0, \
24+
'{code:' + StrInspectSignature(Value) + '}'

0 commit comments

Comments
 (0)