plcopen/Makefile
author Edouard Tisserant <edouard@beremiz.fr>
Thu, 05 Dec 2024 13:56:59 +0100 (3 months ago)
changeset 4060 d2f5eb3c7d6e
parent 2627 3ba6a2d26507
permissions -rw-r--r--
py_ext: fix CSV Writer

fix POU logic :
- SAVE is a BOOL
- invocation of py_eval on rising edge of SAVE
- remove save python argument

fix python:
- use no encoding for file open (python2)
- re-use detected dialect if any
- use no "rt+" and truncate since no need to re-sniff dialect for output file
- return "OK" instead of "#SUCCESS", preventing POU logic to ACK result
- support creating new line if writing just after last line
- support appending data on short rows

fix example:
- use a HMI:Button to trigger CSV write instead of HMI:Input +1
- reload CSVs on on each new CSV opened in file browser
- add display of CSV write output
1353
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
     1
#! gmake
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
     2
2627
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     3
# Makefile to generate XSLT stylesheets from ysl2 files in the same directory
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     4
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     5
# This uses YML2. 
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     6
#   hg clone https://pep.foundation/dev/repos/yml2/
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     7
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     8
# It should be just fine if yml2 is cloned just asside beremiz
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
     9
# otherwise, point yml2path to yml2 source directory
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
    10
#   make yml2path=path/to/yml/dir
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
    11
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
    12
yml2path ?= $(abspath ../../yml2)
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
    13
1353
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    14
ysl2files := $(wildcard *.ysl2)
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    15
xsltfiles := $(patsubst %.ysl2, %.xslt, $(ysl2files))
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    16
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    17
all:$(xsltfiles)
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    18
2627
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
    19
%.xslt: %.ysl2 ../yslt_noindent.yml2
3ba6a2d26507 Moved XSLT model query python code so that XSLT part can be reused for other transformations
Edouard Tisserant
parents: 1936
diff changeset
    20
	$(yml2path)/yml2c -I $(yml2path):../ $< -o $@.tmp
1353
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    21
	xmlstarlet fo $@.tmp > $@
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    22
	rm $@.tmp
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    23
	
fc7aab64589b Added makefile for generating xslt stylesheet from ysl2 files
Laurent Bessard
parents:
diff changeset
    24
clean:
1936
b85b13b1c2ec YSLT auto indent trick is useless here, added yslt_noindent.yml2, regenerated XSLT files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 1353
diff changeset
    25
	rm -f $(xsltfiles)