Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
99a78145
Commit
99a78145
authored
Feb 20, 2020
by
Claes Sjöfors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wb build directories, BuildConvert added
parent
925420fe
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
385 additions
and
8 deletions
+385
-8
src/wbl/pwrb/src/pwrb_c_buildconvert.wb_load
src/wbl/pwrb/src/pwrb_c_buildconvert.wb_load
+102
-0
src/wbl/pwrb/src/pwrb_td_fileconvertnum.wb_load
src/wbl/pwrb/src/pwrb_td_fileconvertnum.wb_load
+73
-0
wb/exp/wb/src/pwr_wb_palette.cnf
wb/exp/wb/src/pwr_wb_palette.cnf
+1
-0
wb/lib/wb/src/wb_build.cpp
wb/lib/wb/src/wb_build.cpp
+90
-1
wb/lib/wb/src/wb_expwnav.cpp
wb/lib/wb/src/wb_expwnav.cpp
+78
-5
wb/lib/wb/src/wb_expwnav.h
wb/lib/wb/src/wb_expwnav.h
+4
-2
wb/lib/wb/src/wb_lfu.cpp
wb/lib/wb/src/wb_lfu.cpp
+37
-0
No files found.
src/wbl/pwrb/src/pwrb_c_buildconvert.wb_load
0 → 100644
View file @
99a78145
!
! ProviewR Open Source Process Control.
! Copyright (C) 2005-2018 SSAB EMEA AB.
!
! This file is part of ProviewR.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with ProviewR. If not, see <http://www.gnu.org/licenses/>
!
! Linking ProviewR statically or dynamically with other modules is
! making a combined work based on ProviewR. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! ProviewR give you permission to, from the build function in the
! ProviewR Configurator, combine ProviewR with modules generated by the
! ProviewR PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of ProviewR (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_c_buildconvert.wb_load -- Defines the class BuildConvert.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group ProjectConfiguration
! @Summary Configures copy of files with conversion from source to build tree.
! The BuildCopy object configures copying of files with conversion from
! source to build tree.
!
! One BuildConvert object causes one or several files (with wildcard
! specification) to be copied from a directory in the source tree to the
! build tree.
!
! The object reside in the project volume beneath an BuildDirectory object.
!
! The copy is carried out when Build Directories in the configurator menu
! is activated, or when the node is built.
!
! If the Options attribute in the BuildDirectory object is set to BuildBeforeNode
! the copy is performed automatically before a node is built.
!
! @b See also
! @classlink BuildConfig pwrb_buildconfig.html
! @classlink BuildDirectory pwrb_builddirectory.html
! @classlink BuildMake pwrb_buildmake.html
! @classlink BuildExecute pwrb_buildexecute.html
!*/
Object BuildConvert $ClassDef 719
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
EndBody
Object DevBody $ObjBodyDef 2
!/**
! Type of conversion.
!*/
Object Conversion $Attribute 1
Body SysBody
Attr TypeRef = "pwrb:Type-FileConvertEnum"
EndBody
EndObject
!/**
! @Summary Source file specification.
! Source file specification.
! The asterisk (*) wild card character can be used in the file
! specification.
!
! Example
! $pwrp_load/*.pwg
!*/
Object Source $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Target file specification.
!*/
Object Target $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
EndObject
EndObject
EndSObject
src/wbl/pwrb/src/pwrb_td_fileconvertnum.wb_load
0 → 100644
View file @
99a78145
!
! ProviewR Open Source Process Control.
! Copyright (C) 2005-2018 SSAB EMEA AB.
!
! This file is part of ProviewR.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with ProviewR. If not, see <http://www.gnu.org/licenses/>
!
! Linking ProviewR statically or dynamically with other modules is
! making a combined work based on ProviewR. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! ProviewR give you permission to, from the build function in the
! ProviewR Configurator, combine ProviewR with modules generated by the
! ProviewR PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of ProviewR (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_fileconvertenum.wb_load -- Defines the enum type FileConvertEnum
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! File conversion type.
!
! @b See also
! @classlink BuildConvert pwrb_buildconvert.html
!*/
Object FileConvertEnum $TypeDef 90
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "FileConvertEnum"
EndBody
!/**
! No conversion..
!*/
Object No $Value
Body SysBody
Attr PgmName = "No"
Attr Text = "No"
Attr Value = 0
EndBody
EndObject
!/**
! Convert from ISO-8859-1 to UTF-8.
!*/
Object ISO88591_UTF8 $Value
Body SysBody
Attr PgmName = "ISO88591_UTF8"
Attr Text = "ISO-8859-1 to UTF-8"
Attr Value = 1
EndBody
EndObject
EndObject
EndSObject
wb/exp/wb/src/pwr_wb_palette.cnf
View file @
99a78145
...
...
@@ -668,6 +668,7 @@ palette ProjectNavigatorPalette
{
class BuildConfig
class BuildDirectory
class BuildConvert
class BuildCopy
class BuildMake
class BuildExecute
...
...
wb/lib/wb/src/wb_build.cpp
View file @
99a78145
...
...
@@ -1884,7 +1884,7 @@ void wb_build::directories(char* dir, bld_ePass pass)
{
pwr_tFileName
fname
;
char
line
[
400
];
char
line_item
[
4
][
250
];
char
line_item
[
5
][
250
];
pwr_tFileName
found_file
;
int
num
;
int
sts
;
...
...
@@ -1998,6 +1998,95 @@ void wb_build::directories(char* dir, bld_ePass pass)
}
dcli_search_file
(
line_item
[
1
],
found_file
,
DCLI_DIR_SEARCH_END
);
}
else
if
(
streq
(
cdh_Low
(
line_item
[
0
]),
"buildconvert"
))
{
pwr_tFileConvertEnum
conversion
;
if
(
num
!=
5
)
{
printf
(
"File corrupt "
pwr_cNameDistribute
);
continue
;
}
if
(
sscanf
(
line_item
[
2
],
"%d"
,
&
conversion
)
!=
1
)
{
printf
(
"File corrupt "
pwr_cNameDistribute
);
continue
;
}
if
((
pass
==
bld_ePass_BeforeNode
&&
!
(
current_options
&
pwr_mBuildDirectoryMask_BuildBeforeNode
))
||
(
pass
==
bld_ePass_AfterNode
&&
!
(
current_options
&
pwr_mBuildDirectoryMask_BuildAfterNode
)))
continue
;
for
(
sts
=
dcli_search_file
(
line_item
[
3
],
found_file
,
DCLI_DIR_SEARCH_INIT
);
ODD
(
sts
);
sts
=
dcli_search_file
(
line_item
[
3
],
found_file
,
DCLI_DIR_SEARCH_NEXT
))
{
// Check if file should be updated
int
update
=
0
;
pwr_tFileName
source
,
target
;
pwr_tFileName
target_dir
;
pwr_tTime
source_time
,
target_time
;
char
*
s
;
strncpy
(
source
,
found_file
,
sizeof
(
source
));
strncpy
(
target
,
line_item
[
4
],
sizeof
(
target
));
sts
=
dcli_file_time
(
source
,
&
source_time
);
if
(
target
[
strlen
(
target
)
-
1
]
==
'/'
)
{
// Target is a directory, add file name
char
*
s
=
strrchr
(
source
,
'/'
);
if
(
!
s
)
strncat
(
target
,
source
,
sizeof
(
target
)
-
strlen
(
target
)
-
1
);
else
strncat
(
target
,
s
+
1
,
sizeof
(
target
)
-
strlen
(
target
)
-
1
);
}
dcli_translate_filename
(
target
,
target
);
sts
=
dcli_file_time
(
target
,
&
target_time
);
if
(
ODD
(
sts
)
&&
time_Acomp
(
&
source_time
,
&
target_time
)
!=
1
)
update
=
0
;
else
update
=
1
;
if
(
!
opt
.
force
&&
!
update
)
continue
;
if
(
EVEN
(
sts
))
{
// Check that directory exist, create if it doesn't
strcpy
(
target_dir
,
target
);
if
((
s
=
strrchr
(
target_dir
,
'/'
)))
{
*
s
=
0
;
sts
=
dcli_file_time
(
target_dir
,
&
target_time
);
if
(
EVEN
(
sts
))
{
sprintf
(
cmd
,
"mkdir -p %s"
,
target_dir
);
system
(
cmd
);
}
}
}
switch
(
conversion
)
{
case
pwr_eFileConvertEnum_No
:
sprintf
(
cmd
,
"cp %s %s"
,
source
,
target
);
break
;
case
pwr_eFileConvertEnum_ISO88591_UTF8
:
sprintf
(
cmd
,
"iconv -f ISO-8859-1 -t UTF-8 < %s > %s"
,
source
,
target
);
break
;
}
system
(
cmd
);
sprintf
(
cmd
,
"Build: convert %s %s -> %s"
,
line_item
[
2
],
source
,
target
);
MsgWindow
::
message
(
'I'
,
cmd
,
msgw_ePop_No
);
// wb_log::log( wlog_eCategory_GeBuild, name, 0);
if
(
m_sts
!=
PWRB__MAKEUPDATED
)
m_sts
=
PWRB__SUCCESS
;
}
dcli_search_file
(
line_item
[
2
],
found_file
,
DCLI_DIR_SEARCH_END
);
}
else
if
(
streq
(
cdh_Low
(
line_item
[
0
]),
"buildmake"
))
{
if
(
num
!=
4
)
{
printf
(
"File corrupt "
pwr_cNameDistribute
);
...
...
wb/lib/wb/src/wb_expwnav.cpp
View file @
99a78145
...
...
@@ -673,7 +673,7 @@ void WbExpWNav::show_builddir()
{
pwr_tFileName
fname
;
char
line
[
400
];
char
line_item
[
4
][
250
];
char
line_item
[
5
][
250
];
pwr_tFileName
found_file
;
int
num
;
int
sts
;
...
...
@@ -748,7 +748,70 @@ void WbExpWNav::show_builddir()
continue
;
}
dir
->
copy_insert
(
source
,
target
,
update
);
dir
->
copy_insert
(
source
,
target
,
pwr_eFileConvertEnum_No
,
update
);
if
(
update
)
dir
->
update
=
1
;
}
dcli_search_file
(
line_item
[
1
],
found_file
,
DCLI_DIR_SEARCH_END
);
ItemExp
*
item
=
new
ItemExp
(
this
,
found_file
,
line_item
[
1
],
0
,
0
,
flow_eDest_IntoLast
);
if
(
dir_update
)
brow_SetRadiobutton
(
item
->
node
,
0
,
1
);
}
else
if
(
streq
(
cdh_Low
(
line_item
[
0
]),
"buildconvert"
))
{
int
dir_update
=
0
;
pwr_tFileConvertEnum
conversion
;
if
(
num
!=
5
)
{
printf
(
"File corrupt "
pwr_cNameDistribute
);
continue
;
}
if
(
sscanf
(
line_item
[
2
],
"%d"
,
&
conversion
)
!=
1
)
{
printf
(
"File corrupt "
pwr_cNameDistribute
);
continue
;
}
for
(
sts
=
dcli_search_file
(
line_item
[
3
],
found_file
,
DCLI_DIR_SEARCH_INIT
);
ODD
(
sts
);
sts
=
dcli_search_file
(
line_item
[
3
],
found_file
,
DCLI_DIR_SEARCH_NEXT
))
{
// Check if file should be updated
int
update
=
0
;
pwr_tFileName
source
,
target
;
pwr_tTime
source_time
,
target_time
;
strncpy
(
source
,
found_file
,
sizeof
(
source
));
strncpy
(
target
,
line_item
[
4
],
sizeof
(
target
));
sts
=
dcli_file_time
(
source
,
&
source_time
);
if
(
target
[
strlen
(
target
)
-
1
]
==
'/'
)
{
// Target is a directory, add file name
char
*
s
=
strrchr
(
source
,
'/'
);
if
(
!
s
)
strncat
(
target
,
source
,
sizeof
(
target
)
-
strlen
(
target
)
-
1
);
else
strncat
(
target
,
s
+
1
,
sizeof
(
target
)
-
strlen
(
target
)
-
1
);
}
dcli_translate_filename
(
target
,
target
);
sts
=
dcli_file_time
(
target
,
&
target_time
);
if
(
ODD
(
sts
)
&&
time_Acomp
(
&
source_time
,
&
target_time
)
!=
1
)
update
=
0
;
else
update
=
1
;
ExpWDir
*
dir
=
dir_find
(
line_item
[
1
]);
if
(
!
dir
)
{
printf
(
"File corrupt "
pwr_cNameDistribute
);
continue
;
}
dir
->
copy_insert
(
source
,
target
,
conversion
,
update
);
if
(
update
)
dir
->
update
=
1
;
}
...
...
@@ -893,11 +956,13 @@ ExpWDir* WbExpWNav::dir_insert(char* name, char* options_str, char* description)
return
dir
;
}
ExpWCopy
*
ExpWDir
::
copy_insert
(
char
*
source
,
char
*
target
,
int
update
)
ExpWCopy
*
ExpWDir
::
copy_insert
(
char
*
source
,
char
*
target
,
pwr_tFileConvertEnum
conversion
,
int
update
)
{
ExpWCopy
*
copy
=
new
ExpWCopy
();
strncpy
(
copy
->
source
,
source
,
sizeof
(
copy
->
source
));
strncpy
(
copy
->
target
,
target
,
sizeof
(
copy
->
target
));
copy
->
conversion
=
conversion
;
copy
->
update
=
update
;
if
(
!
copylist
)
...
...
@@ -994,8 +1059,16 @@ pwr_tStatus WbExpWNav::exp()
if
(
!
cp
->
update
)
continue
;
switch
(
cp
->
conversion
)
{
case
pwr_eFileConvertEnum_No
:
sprintf
(
cmd
,
"cp %s %s"
,
cp
->
source
,
cp
->
target
);
printf
(
"%s
\n
"
,
cmd
);
break
;
case
pwr_eFileConvertEnum_ISO88591_UTF8
:
sprintf
(
cmd
,
"iconv -f ISO-8859-1 -t UTF8 < %s > %s"
,
cp
->
source
,
cp
->
target
);
printf
(
"%s
\n
"
,
cmd
);
break
;
}
sts
=
system
(
cmd
);
if
(
sts
!=
0
)
{
// Check that directory exist, create if it doesn't
...
...
wb/lib/wb/src/wb_expwnav.h
View file @
99a78145
...
...
@@ -40,7 +40,7 @@
/* wb_expwnav.h -- Backupfile display window */
#include "flow_browapi.h"
#include "pwr_baseclasses.h"
#include "wb_bck.h"
typedef
enum
{
...
...
@@ -80,6 +80,7 @@ public:
ExpWCopy
*
prev
;
pwr_tFileName
source
;
pwr_tFileName
target
;
pwr_tFileConvertEnum
conversion
;
ExpWCopy
()
:
next
(
0
),
prev
(
0
)
{
...
...
@@ -127,7 +128,8 @@ public:
options
(
0
)
{
}
ExpWCopy
*
copy_insert
(
char
*
source
,
char
*
target
,
int
update
);
ExpWCopy
*
copy_insert
(
char
*
source
,
char
*
target
,
pwr_tFileConvertEnum
conversion
,
int
update
);
ExpWMake
*
make_insert
(
char
*
dir
,
char
*
makefile
,
int
update
);
ExpWExec
*
exec_insert
(
char
*
dir
,
char
*
command
,
int
update
);
};
...
...
wb/lib/wb/src/wb_lfu.cpp
View file @
99a78145
...
...
@@ -2110,6 +2110,9 @@ pwr_tStatus lfu_SaveDirectoryVolume(
nc
.
isfriend
=
1
;
sts
=
ldh_ObjidToName
(
ldhses
,
fnodeo
.
oid
(),
ldh_eName_Object
,
nodeconfig_name
,
sizeof
(
nodeconfig_name
),
&
size
);
// Get attribute NodeName
a
=
sp
->
attribute
(
fnodeo
.
oid
(),
"RtBody"
,
"NodeName"
);
if
(
!
a
)
{
...
...
@@ -3359,6 +3362,40 @@ pwr_tStatus lfu_SaveDirectoryVolume(
free
(
target_ptr
);
break
;
}
case
pwr_cClass_BuildConvert
:
{
char
target_array
[
10
][
80
];
int
target_cnt
;
pwr_tEnum
*
conversion_ptr
;
sts
=
ldh_GetObjectPar
(
ldhses
,
coid
,
"DevBody"
,
"Conversion"
,
(
char
**
)
&
conversion_ptr
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetObjectPar
(
ldhses
,
coid
,
"DevBody"
,
"Source"
,
(
char
**
)
&
source_ptr
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
ldh_GetObjectPar
(
ldhses
,
coid
,
"DevBody"
,
"Target"
,
(
char
**
)
&
target_ptr
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
// Target can be a list
target_cnt
=
dcli_parse
(
target_ptr
,
","
,
""
,
(
char
*
)
target_array
,
sizeof
(
target_array
)
/
sizeof
(
target_array
[
0
]),
sizeof
(
target_array
[
0
]),
0
);
for
(
int
i
=
0
;
i
<
target_cnt
;
i
++
)
{
str_trim
(
target_array
[
i
],
target_array
[
i
]);
fprintf
(
file
,
"buildconvert %s %d %s%s %s
\n
"
,
cdh_Low
(
fullname
),
*
conversion_ptr
,
dir
,
source_ptr
,
target_array
[
i
]);
}
free
(
conversion_ptr
);
free
(
source_ptr
);
free
(
target_ptr
);
break
;
}
case
pwr_cClass_BuildExecute
:
{
char
*
command_ptr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment