Skip to content

Commit

Permalink
bug fixes (C_cxx to var) & code modernization
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Sep 11, 2024
1 parent ee29865 commit 78bd64a
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 228 deletions.
Binary file modified Build/4DPop-Macros.dmg
Binary file not shown.
Binary file modified Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ
Binary file not shown.
4 changes: 2 additions & 2 deletions Build/Components/4DPop Macros.4dbase/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<key>CFBundleName</key>
<string>4DPop Macros</string>
<key>CFBundleVersion</key>
<string>287</string>
<string>288</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R7</string>
<key>CFBundleLongVersionString</key>
<string>20R7 (286)</string>
<string>20R7 (287)</string>
<key>CFBundleShortVersionString</key>
<string>20R7</string>
<key>CFBundleDisplayName</key>
Expand Down
Binary file modified Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib
Binary file not shown.
Binary file modified Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings
Binary file not shown.
4 changes: 2 additions & 2 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<key>CFBundleName</key>
<string>4DPop Macros</string>
<key>CFBundleVersion</key>
<string>287</string>
<string>288</string>
<key>NSHumanReadableCopyright</key>
<string>©vdl 2009-2024</string>
<key>CFBundleGetInfoString</key>
<string>20R7</string>
<key>CFBundleLongVersionString</key>
<string>20R7 (286)</string>
<string>20R7 (287)</string>
<key>CFBundleShortVersionString</key>
<string>20R7</string>
<key>CFBundleDisplayName</key>
Expand Down
25 changes: 13 additions & 12 deletions Project/Sources/Classes/beautifier.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,19 @@ Function beautify()
End if

// Mark:Use var instead of (_o_)C_xxx
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(604)+"\\(([^\\)]*)\\)").substitute("var \\1 : Blob")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(305)+"\\(([^\\)]*)\\)").substitute("var \\1 : Boolean")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(1488)+"\\(([^\\)]*)\\)").substitute("var \\1 : Collection")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(307)+"\\(([^\\)]*)\\)").substitute("var \\1 : Date")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(283)+"\\(([^\\)]*)\\)").substitute("var \\1 : Integer")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(1216)+"\\(([^\\)]*)\\)").substitute("var \\1 : Object")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(286)+"\\(([^\\)]*)\\)").substitute("var \\1 : Picture")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(301)+"\\(([^\\)]*)\\)").substitute("var \\1 : Pointer")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(285)+"\\(([^\\)]*)\\)").substitute("var \\1 : Real")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(284)+"\\(([^\\)]*)\\)").substitute("var \\1 : Text")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(306)+"\\(([^\\)]*)\\)").substitute("var \\1 : Time")
$code:=This:C1470.rgx.setTarget($code).setPattern("(?mi-s)"+Command name:C538(1683)+"\\(([^\\)]*)\\)").substitute("var \\1")
$pattern:="(?-msi){C_}\\((?!\\w+;\\s*\\$\\{?\\d+\\}?)([^\\)]*)\\)"
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(604))).substitute("var \\1 : Blob")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(305))).substitute("var \\1 : Boolean")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(1488))).substitute("var \\1 : Collection")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(307))).substitute("var \\1 : Date")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(283))).substitute("var \\1 : Integer")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(1216))).substitute("var \\1 : Object")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(286))).substitute("var \\1 : Picture")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(301))).substitute("var \\1 : Pointer")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(285))).substitute("var \\1 : Real")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(284))).substitute("var \\1 : Text")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(306))).substitute("var \\1 : Time")
$code:=This:C1470.rgx.setTarget($code).setPattern(Replace string:C233($pattern; "{C_}"; Command name:C538(1683))).substitute("var \\1")

// Mark:Delete empty lines at the beginning of the method
If (Bool:C1537($options.removeEmptyLinesAtTheBeginOfMethod))
Expand Down
4 changes: 2 additions & 2 deletions Project/Sources/Methods/COMPILER_4DPop.4dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//%attributes = {"invisible":true,"preemptive":"incapable"}
C_OBJECT:C1216(_4DPopMacros; $0)
C_OBJECT:C1216(options; $1)
_O_C_OBJECT:C1216(_4DPopMacros; $0)
_O_C_OBJECT:C1216(options; $1)
233 changes: 112 additions & 121 deletions Project/Sources/Methods/COMPILER_component.4dm
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
//%attributes = {"invisible":true,"preemptive":"incapable"}
var <>list : Integer

C_LONGINT:C283(<>list)
var <>b1; <>b2; <>b3; <>b4; <>b5; <>b6; <>b7; <>b8; <>b9; <>b10; <>b11; <>b12; <>b13; <>b14; <>b15 : Integer

var <>timerEvent : Integer
var <>Txt_buffer; <>Txt_method : Text

var <>Txt_Title : Text

var <>regexFilePath : Text

C_LONGINT:C283(<>b1; <>b2; <>b3; <>b4; <>b5; <>b6; <>b7; <>b8; <>b9; <>b10; <>b11; <>b12; <>b13; <>b14; <>b15)
var <>About_Pict_Displayed : Picture
var <>About_Lon_Flip; <>About_Lon_AutoHide; <>About_Lon_Image : Integer
var <>About_Txt_Buffer; <>About_Txt_Macro; <>About_Txt_Displayed : Text

C_LONGINT:C283(<>timerEvent)
C_TEXT:C284(<>Txt_buffer; <>Txt_method)
var <>Boo_declarationInited : Boolean

C_TEXT:C284(<>Txt_Title)


C_TEXT:C284(<>regexFilePath)

C_PICTURE:C286(<>About_Pict_Displayed)
C_LONGINT:C283(<>About_Lon_Flip; <>About_Lon_AutoHide; <>About_Lon_Image)
C_TEXT:C284(<>About_Txt_Buffer; <>About_Txt_Macro; <>About_Txt_Displayed)

C_BOOLEAN:C305(<>Boo_declarationInited)

C_TEXT:C284(<>About_Txt_Displayed)
ARRAY TEXT:C222(<>tTxt_2D_Declaration_Patterns; 0; 0)
ARRAY LONGINT:C221(<>tLon_Declaration_Types; 0)

Expand All @@ -43,175 +37,172 @@ var v1; v2; v3; v4 : Variant

If (False:C215)


If (False:C215)
C_OBJECT:C1216(declaration_UI; $0)
C_TEXT:C284(declaration_UI; $1)
C_OBJECT:C1216(declaration_UI; $2)
_O_C_OBJECT:C1216(declaration_UI; $0)
_O_C_TEXT:C284(declaration_UI; $1)
_O_C_OBJECT:C1216(declaration_UI; $2)
End if

C_TEXT:C284(codeForCollection; $0)
C_COLLECTION:C1488(codeForCollection; $1)
C_TEXT:C284(codeForCollection; $2)
_O_C_TEXT:C284(codeForCollection; $0)

_O_C_COLLECTION:C1488(codeForCollection; $1)
_O_C_TEXT:C284(codeForCollection; $2)

C_TEXT:C284(codeForObject; $0)
C_OBJECT:C1216(codeForObject; $1)
C_TEXT:C284(codeForObject; $2)
_O_C_TEXT:C284(codeForObject; $0)
_O_C_OBJECT:C1216(codeForObject; $1)
_O_C_TEXT:C284(codeForObject; $2)

//C_OBJECT(macro; $0)
//C_TEXT(macro; $1)
//C_OBJECT(macro; $2)
// C_OBJECT(macro; $0)
// C_TEXT(macro; $1)
// C_OBJECT(macro; $2)

C_TEXT:C284(_o_localizedControlFlow; $0)
C_TEXT:C284(_o_localizedControlFlow; $1)
C_POINTER:C301(_o_localizedControlFlow; $2)
C_POINTER:C301(_o_localizedControlFlow; $3)
_O_C_TEXT:C284(_o_localizedControlFlow; $0)
_O_C_TEXT:C284(_o_localizedControlFlow; $1)
_O_C_POINTER:C301(_o_localizedControlFlow; $2)
_O_C_POINTER:C301(_o_localizedControlFlow; $3)

C_TEXT:C284(DOT_NOTATION; $1)
_O_C_TEXT:C284(DOT_NOTATION; $1)

// Private_Boo_Get_Resource
C_BOOLEAN:C305(Get_resource; $0)
C_TEXT:C284(Get_resource; $1)
C_TEXT:C284(Get_resource; $2)
C_POINTER:C301(Get_resource; $3)
_O_C_BOOLEAN:C305(Get_resource; $0)
_O_C_TEXT:C284(Get_resource; $1)
_O_C_TEXT:C284(Get_resource; $2)
_O_C_POINTER:C301(Get_resource; $3)

// Private_Boo_Install_Resources
C_BOOLEAN:C305(Install_resources; $0)
_O_C_BOOLEAN:C305(Install_resources; $0)

// Private_Txt_Get_Version
C_TEXT:C284(Get_Version; $0)
C_TEXT:C284(Get_Version; $1)
_O_C_TEXT:C284(Get_Version; $0)
_O_C_TEXT:C284(Get_Version; $1)

// Private_Boo_Set_Preferences
C_BOOLEAN:C305(_o_Preferences_Set; $0)
C_TEXT:C284(_o_Preferences_Set; $1)
C_TEXT:C284(_o_Preferences_Set; $2)
_O_C_BOOLEAN:C305(_o_Preferences_Set; $0)
_O_C_TEXT:C284(_o_Preferences_Set; $1)
_O_C_TEXT:C284(_o_Preferences_Set; $2)

C_LONGINT:C283(Beautifier_init; $0)
_O_C_LONGINT:C283(Beautifier_init; $0)

// Private_SET_OPTIONS
C_LONGINT:C283(OPTIONS_SET; ${1})
_O_C_LONGINT:C283(OPTIONS_SET; ${1})

// Private_Boo_Paste_Regex_Pattern
C_BOOLEAN:C305(Private_Boo_Paste_Regex_Pattern; $0)
_O_C_BOOLEAN:C305(Private_Boo_Paste_Regex_Pattern; $0)

// METHOD_Syntax
C_TEXT:C284(METHOD_Syntax; $0)
C_TEXT:C284(METHOD_Syntax; $1)
C_TEXT:C284(METHOD_Syntax; $2)
C_TEXT:C284(METHOD_Syntax; $3)
_O_C_TEXT:C284(METHOD_Syntax; $0)
_O_C_TEXT:C284(METHOD_Syntax; $1)
_O_C_TEXT:C284(METHOD_Syntax; $2)
_O_C_TEXT:C284(METHOD_Syntax; $3)

// METHOD_ANALYSE_TO_ARRAYS
C_TEXT:C284(METHOD_ANALYSE_TO_ARRAYS; $1)
C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $2)
C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $3)
C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $4)
_O_C_TEXT:C284(METHOD_ANALYSE_TO_ARRAYS; $1)
_O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $2)
_O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $3)
_O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $4)

// Private_Methods
C_TEXT:C284(METHODS; $1)
C_TEXT:C284(METHODS; $2)
_O_C_TEXT:C284(METHODS; $1)
_O_C_TEXT:C284(METHODS; $2)

C_TEXT:C284(Util_SPLIT_METHOD; $1)
C_POINTER:C301(Util_SPLIT_METHOD; $2)
C_LONGINT:C283(Util_SPLIT_METHOD; $3)
_O_C_TEXT:C284(Util_SPLIT_METHOD; $1)
_O_C_POINTER:C301(Util_SPLIT_METHOD; $2)
_O_C_LONGINT:C283(Util_SPLIT_METHOD; $3)

C_LONGINT:C283(util_Lon_Local_in_line; $0)
C_TEXT:C284(util_Lon_Local_in_line; $1)
C_POINTER:C301(util_Lon_Local_in_line; $2)
C_POINTER:C301(util_Lon_Local_in_line; $3)
C_LONGINT:C283(util_Lon_Local_in_line; $4)
_O_C_LONGINT:C283(util_Lon_Local_in_line; $0)
_O_C_TEXT:C284(util_Lon_Local_in_line; $1)
_O_C_POINTER:C301(util_Lon_Local_in_line; $2)
_O_C_POINTER:C301(util_Lon_Local_in_line; $3)
_O_C_LONGINT:C283(util_Lon_Local_in_line; $4)

// Private_Txt_Get_Preferences
C_TEXT:C284(Preferences_Get; $0)
C_TEXT:C284(Preferences_Get; $1)
_O_C_TEXT:C284(Preferences_Get; $0)
_O_C_TEXT:C284(Preferences_Get; $1)

// Private_Boo_Install_Regex
C_BOOLEAN:C305(Install_regex; $0)
_O_C_BOOLEAN:C305(Install_regex; $0)

C_BOOLEAN:C305(_o_Preferences; $0)
C_TEXT:C284(_o_Preferences; $1)
C_TEXT:C284(_o_Preferences; $2)
C_POINTER:C301(_o_Preferences; $3)
_O_C_BOOLEAN:C305(_o_Preferences; $0)
_O_C_TEXT:C284(_o_Preferences; $1)
_O_C_TEXT:C284(_o_Preferences; $2)
_O_C_POINTER:C301(_o_Preferences; $3)

// BEAUTIFIER
C_TEXT:C284(_o_Beautifier; $0)
C_TEXT:C284(_o_Beautifier; $1)
C_BOOLEAN:C305(_o_Beautifier; $2)
_O_C_TEXT:C284(_o_Beautifier; $0)
_O_C_TEXT:C284(_o_Beautifier; $1)
_O_C_BOOLEAN:C305(_o_Beautifier; $2)

C_LONGINT:C283(_o_beautifier_Next_semicolon; $0)
C_TEXT:C284(_o_beautifier_Next_semicolon; $1)
_O_C_LONGINT:C283(_o_beautifier_Next_semicolon; $0)
_O_C_TEXT:C284(_o_beautifier_Next_semicolon; $1)

C_TEXT:C284(_o_beautifier_Split_key_value; $0)
C_TEXT:C284(_o_beautifier_Split_key_value; $1)
C_LONGINT:C283(_o_beautifier_Split_key_value; $2)
_O_C_TEXT:C284(_o_beautifier_Split_key_value; $0)
_O_C_TEXT:C284(_o_beautifier_Split_key_value; $1)
_O_C_LONGINT:C283(_o_beautifier_Split_key_value; $2)

// Private_GET_OPTIONS
C_LONGINT:C283(OPTIONS_GET; ${1})
_O_C_LONGINT:C283(OPTIONS_GET; ${1})

// M_4DPOP_OBOO_INIT
C_BOOLEAN:C305(Init; $0)

_O_C_BOOLEAN:C305(Init; $0)

// COMMENTS
C_TEXT:C284(COMMENTS; $1)
C_TEXT:C284(COMMENTS; $2)
C_TEXT:C284(COMMENTS; $3)
_O_C_TEXT:C284(COMMENTS; $1)
_O_C_TEXT:C284(COMMENTS; $2)
_O_C_TEXT:C284(COMMENTS; $3)

// Private_INVERT_EXPRESSION
C_TEXT:C284(INVERT_EXPRESSION; $0)
C_LONGINT:C283(INVERT_EXPRESSION; ${3})
C_LONGINT:C283(INVERT_EXPRESSION; $1)
C_LONGINT:C283(INVERT_EXPRESSION; $2)
C_LONGINT:C283(INVERT_EXPRESSION; $3)
C_LONGINT:C283(INVERT_EXPRESSION; $4)
C_LONGINT:C283(INVERT_EXPRESSION; $5)
C_LONGINT:C283(INVERT_EXPRESSION; $6)
_O_C_TEXT:C284(INVERT_EXPRESSION; $0)
_O_C_LONGINT:C283(INVERT_EXPRESSION; ${3})
_O_C_LONGINT:C283(INVERT_EXPRESSION; $1)
_O_C_LONGINT:C283(INVERT_EXPRESSION; $2)
_O_C_LONGINT:C283(INVERT_EXPRESSION; $3)
_O_C_LONGINT:C283(INVERT_EXPRESSION; $4)
_O_C_LONGINT:C283(INVERT_EXPRESSION; $5)
_O_C_LONGINT:C283(INVERT_EXPRESSION; $6)

// Str_gBoo_IsNumeric
C_BOOLEAN:C305(_o_isNumeric; $0)
C_TEXT:C284(_o_isNumeric; $1)

_O_C_BOOLEAN:C305(_o_isNumeric; $0)
_O_C_TEXT:C284(_o_isNumeric; $1)

// PRIVATE_4DPOP_ABOUT
C_TEXT:C284(ABOUT; $1)
_O_C_TEXT:C284(ABOUT; $1)

// Str_gLon_Hex_To_Long
C_LONGINT:C283(str_gLon_Hex_To_Long; $0)
C_TEXT:C284(str_gLon_Hex_To_Long; $1)
_O_C_LONGINT:C283(str_gLon_Hex_To_Long; $0)
_O_C_TEXT:C284(str_gLon_Hex_To_Long; $1)

// Str_hyphenation
C_TEXT:C284(str_hyphenation; $0)
C_TEXT:C284(str_hyphenation; $1)
C_LONGINT:C283(str_hyphenation; $2)
C_TEXT:C284(str_hyphenation; $3)
C_TEXT:C284(str_hyphenation; $4)
_O_C_TEXT:C284(str_hyphenation; $0)
_O_C_TEXT:C284(str_hyphenation; $1)
_O_C_LONGINT:C283(str_hyphenation; $2)
_O_C_TEXT:C284(str_hyphenation; $3)
_O_C_TEXT:C284(str_hyphenation; $4)

// Doc_gTxt_Files_And_Folders
C_TEXT:C284(_o_Files_And_Folders; $0)
C_TEXT:C284(_o_Files_And_Folders; $1)
C_TEXT:C284(_o_Files_And_Folders; $2)
C_TEXT:C284(_o_Files_And_Folders; $3)
C_BOOLEAN:C305(_o_Files_And_Folders; $4)

_O_C_TEXT:C284(_o_Files_And_Folders; $0)
_O_C_TEXT:C284(_o_Files_And_Folders; $1)
_O_C_TEXT:C284(_o_Files_And_Folders; $2)
_O_C_TEXT:C284(_o_Files_And_Folders; $3)
_O_C_BOOLEAN:C305(_o_Files_And_Folders; $4)

// Win_NOT_UNDER_TOOLBAR
C_LONGINT:C283(win_NOT_UNDER_TOOLBAR; $0)
_O_C_LONGINT:C283(win_NOT_UNDER_TOOLBAR; $0)

// Win_title
C_TEXT:C284(win_title; $0)
C_LONGINT:C283(win_title; $1)
_O_C_TEXT:C284(win_title; $0)
_O_C_LONGINT:C283(win_title; $1)

// Private_Lon_Declaration_Type
C_LONGINT:C283(Private_Lon_Declaration_Type; $0)
C_TEXT:C284(Private_Lon_Declaration_Type; $1)
C_POINTER:C301(Private_Lon_Declaration_Type; $2)
_O_C_LONGINT:C283(Private_Lon_Declaration_Type; $0)
_O_C_TEXT:C284(Private_Lon_Declaration_Type; $1)
_O_C_POINTER:C301(Private_Lon_Declaration_Type; $2)

// Private_EXTRACT_LOCAL_VARIABLES
C_TEXT:C284(_o_EXTRACT_LOCAL_VARIABLES; $1)
C_POINTER:C301(_o_EXTRACT_LOCAL_VARIABLES; $2)
_O_C_TEXT:C284(_o_EXTRACT_LOCAL_VARIABLES; $1)
_O_C_POINTER:C301(_o_EXTRACT_LOCAL_VARIABLES; $2)

//C_TEXT(SETTINGS; $1)
// C_TEXT(SETTINGS; $1)

C_POINTER:C301(4DPop_MACROS_SETTINGS; $1)
_O_C_POINTER:C301(4DPop_MACROS_SETTINGS; $1)

End if
Loading

0 comments on commit 78bd64a

Please sign in to comment.