Skip to content

Commit

Permalink
#DECLARE & var - part 4
Browse files Browse the repository at this point in the history
  • Loading branch information
vdelachaux committed Sep 24, 2024
1 parent 956dd64 commit ab05c2a
Show file tree
Hide file tree
Showing 16 changed files with 1,326 additions and 1,684 deletions.
1,423 changes: 722 additions & 701 deletions Project/Sources/Methods/00_test.4dm

Large diffs are not rendered by default.

61 changes: 0 additions & 61 deletions Project/Sources/Methods/Compiler_SVG_Public.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,6 @@
// Created 04/07/08 by Vincent de Lachaux
// ----------------------------------------------------

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//Document
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
If (False:C215)

//SVG_SET_DEFAULT_ENCODING
_O_C_TEXT:C284(SVG_SET_DEFAULT_ENCODING; $1)

//SVG_Get_default_encoding
_O_C_TEXT:C284(SVG_Get_default_encoding; $0)

//SVG_CLEAR
_O_C_TEXT:C284(SVG_CLEAR; $1)

//SVG_Copy
_O_C_TEXT:C284(SVG_Copy; $0)
_O_C_TEXT:C284(SVG_Copy; $1)

//SVG_Export_to_picture
_O_C_PICTURE:C286(SVG_Export_to_picture; $0)
_O_C_TEXT:C284(SVG_Export_to_picture; $1)
_O_C_LONGINT:C283(SVG_Export_to_picture; $2)

//SVG_Export_to_XML
_O_C_TEXT:C284(SVG_Export_to_XML; $0)
_O_C_TEXT:C284(SVG_Export_to_XML; $1)

//SVG_New
_O_C_TEXT:C284(SVG_New; $0)
_O_C_REAL:C285(SVG_New; $1)
_O_C_REAL:C285(SVG_New; $2)
_O_C_TEXT:C284(SVG_New; $3)
_O_C_TEXT:C284(SVG_New; $4)
_O_C_BOOLEAN:C305(SVG_New; $5)
_O_C_LONGINT:C283(SVG_New; $6)

//SVG_Open_file
_O_C_TEXT:C284(SVG_Open_file; $0)
_O_C_TEXT:C284(SVG_Open_file; $1)
_O_C_BOOLEAN:C305(SVG_Open_file; $2)

//SVG_Open_picture
_O_C_TEXT:C284(SVG_Open_picture; $0)
_O_C_PICTURE:C286(SVG_Open_picture; $1)

//SVG_SAVE_AS_PICTURE
_O_C_TEXT:C284(SVG_SAVE_AS_PICTURE; $1)
_O_C_TEXT:C284(SVG_SAVE_AS_PICTURE; $2)
_O_C_TEXT:C284(SVG_SAVE_AS_PICTURE; $3)

//SVG_SAVE_AS_TEXT
_O_C_TEXT:C284(SVG_SAVE_AS_TEXT; $1)
_O_C_TEXT:C284(SVG_SAVE_AS_TEXT; $2)

//SVG_Validate_file
_O_C_BOOLEAN:C305(SVG_Validate_file; $0)
_O_C_TEXT:C284(SVG_Validate_file; $1)

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
End if

//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//Structure & definition
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Expand Down
105 changes: 48 additions & 57 deletions Project/Sources/Methods/SVG_CLEAR.4dm
Original file line number Diff line number Diff line change
@@ -1,56 +1,49 @@
//%attributes = {"invisible":true,"shared":true,"preemptive":"capable"}
// ----------------------------------------------------
// Method : SVG_CLEAR
// Date et heure : 16/03/06, 10:07:53
// Framework SVgg
// Author : Gérald Czwiklinski
// ----------------------------------------------------
// Releases the memory occupied by a SVG tree.
// ----------------------------------------------------
// Modified by Vincent de Lachaux (09/09/08)
// Merge with CLEAR_ALL
// ----------------------------------------------------
// Modified by Vincent de Lachaux (16/06/08)
// 2004 -> v11
// ----------------------------------------------------
// Modified by Vincent de Lachaux (04/07/11)
// If the reference is an object reference, the object is deleted
// ----------------------------------------------------
C_TEXT:C284($1)
// ----------------------------------------------------
// Method : SVG_CLEAR
// Date et heure : 16/03/06, 10:07:53
// Framework SVgg
// Author : Gérald Czwiklinski
// ----------------------------------------------------
// Releases the memory occupied by a SVG tree.
// ----------------------------------------------------
// Modified by Vincent de Lachaux (09/09/08)
// Merge with CLEAR_ALL
// ----------------------------------------------------
// Modified by Vincent de Lachaux (16/06/08)
// 2004 -> v11
// ----------------------------------------------------
// Modified by Vincent de Lachaux (04/07/11)
// If the reference is an object reference, the object is deleted
// ----------------------------------------------------
#DECLARE($svgObject : Text)

C_LONGINT:C283($Lon_parameters;$Lon_x)
C_TEXT:C284($Dom_root;$Dom_svgObject;$kTxt_currentMethod;$kTxt_Error_Method)
var $kTxt_currentMethod; $root : Text
var $Lon_x : Integer

If (False:C215)
C_TEXT:C284(SVG_CLEAR ;$1)
End if
Compiler_SVG

Compiler_SVG
$kTxt_currentMethod:="SVG_CLEAR" // Nom methode courante

$Lon_parameters:=Count parameters:C259
$kTxt_currentMethod:="SVG_CLEAR" //Nom methode courante

If ($Lon_parameters>=1)

$Dom_svgObject:=$1
If (Count parameters:C259>=1)

If (Asserted:C1132(xml_referenceValid ($Dom_svgObject);Get localized string:C991("error_badReference")))
If (Asserted:C1132(xml_referenceValid($svgObject); Localized string:C991("error_badReference")))

Component_errorHandler ("init";$kTxt_currentMethod)
Component_errorHandler("init"; $kTxt_currentMethod)

$Dom_root:=DOM Get root XML element:C1053($Dom_svgObject)
$root:=DOM Get root XML element:C1053($svgObject)

If ($Dom_root=$Dom_svgObject)
If ($root=$svgObject)

// Close the XML tree
DOM CLOSE XML:C722($Dom_svgObject)
// Close the XML tree
DOM CLOSE XML:C722($svgObject)

If (OK=1)

// Delete the registered reference {
// Delete the registered reference {
If (Storage:C1525.svg.docs#Null:C1517)

$Lon_x:=Storage:C1525.svg.docs.indexOf($Dom_svgObject)
$Lon_x:=Storage:C1525.svg.docs.indexOf($svgObject)

If ($Lon_x#-1)

Expand All @@ -61,43 +54,41 @@ If ($Lon_parameters>=1)
End use
End if
End if
//}

// }

End if

Else

// Delete the element
DOM REMOVE XML ELEMENT:C869($Dom_svgObject)
// Delete the element
DOM REMOVE XML ELEMENT:C869($svgObject)

End if

ASSERT:C1129(Component_errorHandler ("deinit"))
ASSERT:C1129(Component_errorHandler("deinit"))

Else

ASSERT:C1129(Component_putError (8852;$kTxt_currentMethod)) // The reference is not a svg object
ASSERT:C1129(Component_putError(8852; $kTxt_currentMethod)) // The reference is not a svg object

End if

Else

$kTxt_Error_Method:=Method called on error:C704

ON ERR CALL:C155("xToolBox_NO_ERROR") //=========================== < NO ERROR >

Use (Storage:C1525)
Try // < NO ERROR >

For each ($Dom_svgObject;Storage:C1525.svg.docs)
Use (Storage:C1525)

DOM CLOSE XML:C722($Dom_svgObject)
For each ($svgObject; Storage:C1525.svg.docs)

DOM CLOSE XML:C722($svgObject)

End for each

End for each

Storage:C1525.svg.docs.clear()
Storage:C1525.svg.docs.clear()
End use

End use

ON ERR CALL:C155($kTxt_Error_Method) //============================= </ NO ERROR >

End try // </ NO ERROR >
End if
94 changes: 36 additions & 58 deletions Project/Sources/Methods/SVG_Copy.4dm
Original file line number Diff line number Diff line change
@@ -1,83 +1,61 @@
//%attributes = {"invisible":true,"shared":true,"preemptive":"capable"}
// ----------------------------------------------------
// Method : SVG_Copy
// Created 16/06/08 by Vincent de Lachaux
// ----------------------------------------------------
// Description
// Create a copy of the svg document
// ----------------------------------------------------
C_TEXT:C284($0)
C_TEXT:C284($1)
// ----------------------------------------------------
// Method : SVG_Copy
// Created 16/06/08 by Vincent de Lachaux
// ----------------------------------------------------
// Description
// Create a copy of the svg document
// ----------------------------------------------------
#DECLARE($svgObject : Text) : Text

C_LONGINT:C283($Lon_parameters)
C_TEXT:C284($Dom_new;$kTxt_currentMethod;$Txt_Buffer;$Txt_svgObject)
var $CURRENT_METHOD; $root; $t : Text

If (False:C215)
C_TEXT:C284(SVG_Copy ;$0)
C_TEXT:C284(SVG_Copy ;$1)
End if
Compiler_SVG

Compiler_SVG

$Lon_parameters:=Count parameters:C259
$kTxt_currentMethod:="SVG_Copy" //Nom methode courante
$CURRENT_METHOD:="SVG_Copy"

Case of

//______________________________________________________
: ($Lon_parameters=0)
//______________________________________________________
: (Count parameters:C259=0)

ASSERT:C1129(Component_putError (8850;$kTxt_currentMethod)) //Argument missing
ASSERT:C1129(Component_putError(8850; $CURRENT_METHOD)) // Argument missing

//________________________________________
: (Not:C34(xml_referenceValid ($1)))
//________________________________________
: (Not:C34(xml_referenceValid($svgObject)))

ASSERT:C1129(Component_putError (8852;$kTxt_currentMethod)) //The reference is not a svg object
ASSERT:C1129(Component_putError(8852; $CURRENT_METHOD)) // The reference is not a svg object

//______________________________________________________
//______________________________________________________
Else

Component_errorHandler ("init";$kTxt_currentMethod)

$Txt_svgObject:=$1

// ___________________
// / ACI0072296
// || Date 18/07/11
//( ) Vincent de Lachaux
// ___________________
XML SET OPTIONS:C1090($Txt_svgObject;XML indentation:K45:34;XML no indentation:K45:36)
Component_errorHandler("init"; $CURRENT_METHOD)

// ___________________
// ___________________
// / ACI0072296
// || Date 18/07/11
// ( ) Vincent de Lachaux
// ___________________
XML SET OPTIONS:C1090($svgObject; XML indentation:K45:34; XML no indentation:K45:36)
// ___________________

DOM EXPORT TO VAR:C863($Txt_svgObject;$Txt_Buffer)
DOM EXPORT TO VAR:C863($svgObject; $t)

If (OK=1)
If (Bool:C1537(OK))

$Dom_new:=DOM Parse XML variable:C720($Txt_Buffer)
$root:=DOM Parse XML variable:C720($t)

If (OK=1)
If (Bool:C1537(OK))

// Store the reference {
Use (Storage:C1525.svg)

If (Storage:C1525.svg.docs=Null:C1517)

Storage:C1525.svg.docs:=New shared collection:C1527

End if

Storage:C1525.svg.docs.push($Dom_new)

End use
//}

$0:=$Dom_new
// Store the reference
pushReference($root)

End if
End if

ASSERT:C1129(Component_errorHandler ("deinit"))
ASSERT:C1129(Component_errorHandler("deinit"))

return $root

//______________________________________________________
//______________________________________________________
End case
Loading

0 comments on commit ab05c2a

Please sign in to comment.