Skip to content

Commit ec74d91

Browse files
committed
some modernisation of the code
1 parent faf9bff commit ec74d91

File tree

11 files changed

+89
-105
lines changed

11 files changed

+89
-105
lines changed

Build/4DPop-Macros.dmg

-132 KB
Binary file not shown.

Build/4DPop-Macros.zip

8.52 KB
Binary file not shown.
Binary file not shown.

Build/Components/4DPop Macros.4dbase/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<key>CFBundleName</key>
77
<string>4DPop Macros</string>
88
<key>CFBundleVersion</key>
9-
<string>285</string>
9+
<string>286</string>
1010
<key>NSHumanReadableCopyright</key>
1111
<string>©vdl 2009-2024</string>
1212
<key>CFBundleGetInfoString</key>
1313
<string>20R6</string>
1414
<key>CFBundleLongVersionString</key>
15-
<string>20R6 (284)</string>
15+
<string>20R6 (285)</string>
1616
<key>CFBundleShortVersionString</key>
1717
<string>20R6</string>
1818
<key>CFBundleDisplayName</key>
Binary file not shown.
Binary file not shown.

Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
<key>CFBundleName</key>
77
<string>4DPop Macros</string>
88
<key>CFBundleVersion</key>
9-
<string>285</string>
9+
<string>286</string>
1010
<key>NSHumanReadableCopyright</key>
1111
<string>©vdl 2009-2024</string>
1212
<key>CFBundleGetInfoString</key>
1313
<string>20R6</string>
1414
<key>CFBundleLongVersionString</key>
15-
<string>20R6 (284)</string>
15+
<string>20R6 (285)</string>
1616
<key>CFBundleShortVersionString</key>
1717
<string>20R6</string>
1818
<key>CFBundleDisplayName</key>

Project/Sources/Classes/declaration.4dm

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
Class extends macro
22

3-
property lines; locales; parameters; classes; types : Collection
3+
property lines : Collection:=[]
4+
property locales : Collection:=[]
5+
property parameters : Collection:=[]
6+
property classes : Collection:=[]
7+
property types : Collection:=[]
48

59
//ACI0104313
610
//property $notforArray : Collection
711
//property $inCommentBlock: Boolean
812

913
property settings : Object
10-
property localeNumber; parameterNumber : Integer
14+
15+
property localeNumber : Integer:=0
16+
property parameterNumber : Integer:=0
1117

1218
property _patterns : Object
1319

@@ -30,12 +36,6 @@ Class constructor
3036

3137
End if
3238

33-
This:C1470.lines:=[]
34-
This:C1470.locales:=[]
35-
This:C1470.parameters:=[]
36-
This:C1470.classes:=[]
37-
This:C1470.types:=[]
38-
3939
This:C1470.$notforArray:=["collection"; "variant"]
4040

4141
// Flags
@@ -1496,8 +1496,6 @@ Function loadGramSyntax()
14961496

14971497
var $t : Text
14981498
var $first; $i; $return : Integer
1499-
var $patterns : Object
1500-
var $file : 4D:C1709.File
15011499

15021500
This:C1470.gramSyntax:=New object:C1471(\
15031501
String:C10(Is object:K8:27); []; \
@@ -1520,12 +1518,14 @@ Function loadGramSyntax()
15201518
String:C10(Is time:K8:8)+"_1"; []; \
15211519
String:C10(Is BLOB:K8:12)+"_1"; [])
15221520

1521+
var $file : 4D:C1709.File
15231522
$file:=Is macOS:C1572\
15241523
? Folder:C1567(Application file:C491; fk platform path:K87:2).file("Contents/Resources/gram.4dsyntax")\
15251524
: File:C1566(Application file:C491; fk platform path:K87:2).parent.file("Resources/gram.4dsyntax")
15261525

15271526
If ($file.exists)
15281527

1528+
var $patterns : Object
15291529
$patterns:={\
15301530
affectation: "(?m-is)\\%:=(?:(?:#)(?=$|\\(|(?:\\s*"+kCommentMark+")|(?:\\s*/\\*))"; \
15311531
affectationSuite: "|(?:#)(?=$|\\(|(?:\\s*"+kCommentMark+")|(?:\\s*/\\*))"; \

Project/Sources/Classes/macro.4dm

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1-
property title; name; objectName; method; highlighted; decimalSeparator : Text
2-
property class; form; trigger; projectMethod; objectMethod; withSelection : Boolean
3-
property lineTexts : Collection
1+
property title : Text:=Get window title:C450(Frontmost window:C447)
2+
property name : Text:=""
3+
property objectName : Text:=""
4+
property method : Text:=""
5+
property highlighted : Text:=""
6+
7+
property class : Boolean:=False:C215
8+
property form : Boolean:=False:C215
9+
property trigger : Boolean:=False:C215
10+
property projectMethod : Boolean:=False:C215
11+
property objectMethod : Boolean:=False:C215
12+
property withSelection : Boolean:=False:C215
13+
14+
property lineTexts : Collection:=[]
15+
property decimalSeparator : Text
416
property _controlFlow : Object
5-
property rgx : cs:C1710.regex
17+
property rgx : cs:C1710.regex:=cs:C1710.regex.new()
618

719
Class constructor()
820

@@ -12,20 +24,10 @@ Class constructor()
1224
ARRAY LONGINT:C221($len; 0)
1325
ARRAY LONGINT:C221($pos; 0)
1426

15-
This:C1470.title:=Get window title:C450(Frontmost window:C447)
16-
1727
// Identify the name & the type of the current method
18-
This:C1470.name:=""
19-
This:C1470.objectName:=""
20-
This:C1470.projectMethod:=False:C215
21-
This:C1470.objectMethod:=False:C215
22-
This:C1470.class:=False:C215
23-
This:C1470.form:=False:C215
24-
This:C1470.trigger:=False:C215
25-
2628
If (Match regex:C1019("(?m-si)^([^:]*\\s*:\\s)([[:ascii:]]*)(\\.[[:ascii:]]*)?(?:\\s*\\*)?$"; This:C1470.title; 1; $pos; $len))
2729

28-
$ƒ:=Formula from string:C1601(Parse formula:C1576("_localized string:C1578($1)"))
30+
$ƒ:=Formula from string:C1601(Parse formula:C1576("Get localized string:C1578($1)"))
2931
$t:=Substring:C12(This:C1470.title; $pos{1}; $len{1})
3032
This:C1470.projectMethod:=($t=$ƒ.call(Null:C1517; "common_method"))
3133
This:C1470.objectMethod:=($t=$ƒ.call(Null:C1517; "common_objectMethod"))
@@ -47,10 +49,6 @@ Class constructor()
4749

4850
End if
4951

50-
This:C1470.method:=""
51-
This:C1470.highlighted:=""
52-
This:C1470.withSelection:=False:C215
53-
5452
If (This:C1470.form)
5553

5654
// #TO_DO 🚧
@@ -68,13 +66,9 @@ Class constructor()
6866

6967
End if
7068

71-
This:C1470.lineTexts:=[]
72-
7369
GET SYSTEM FORMAT:C994(Decimal separator:K60:1; $t)
7470
This:C1470.decimalSeparator:=$t
7571

76-
This:C1470.rgx:=cs:C1710.regex.new()
77-
7872
// <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <==
7973
Function get macroCall() : Boolean
8074

@@ -258,7 +252,8 @@ Function ConvertToCallWithToken()
258252

259253
End if
260254

261-
If (This:C1470.highlighted="\"@") & (This:C1470.highlighted="@\"")
255+
If (This:C1470.highlighted="\"@")\
256+
&& (This:C1470.highlighted="@\"")
262257

263258
SET MACRO PARAMETER:C998(Highlighted method text:K5:18; "Formula:C1597("+Replace string:C233(This:C1470.highlighted; "\""; "")+").source")
264259
POST KEY:C465(3)
@@ -453,7 +448,7 @@ Function _comment() : Text
453448
If ($c.length=1)
454449

455450
var v1; v2; v3; v4 : Variant
456-
Formula from string:C1601(":C1810(v1; v2; v3; v4)").call()
451+
Formula from string:C1601("4D:C1810(v1; v2; v3; v4)").call()
457452

458453
If ($c[0]=Split string:C1554(This:C1470.method; "\r")[v3])
459454

@@ -489,11 +484,11 @@ Function _paste($text : Text; $useSelection : Boolean)
489484

490485
If (Count parameters:C259>=2)
491486

492-
$target:=Choose:C955($useSelection; Highlighted method text:K5:18; Full method text:K5:17)
487+
$target:=$useSelection ? Highlighted method text:K5:18 : Full method text:K5:17
493488

494489
Else
495490

496-
$target:=Choose:C955(This:C1470.withSelection; Highlighted method text:K5:18; Full method text:K5:17)
491+
$target:=This:C1470.withSelection ? Highlighted method text:K5:18 : Full method text:K5:17
497492

498493
End if
499494

0 commit comments

Comments
 (0)