Files
Gen4_R-Car_Trace32/2_Trunk/demo/practice/winpos.cmm
2025-10-14 09:52:32 +09:00

76 lines
2.3 KiB
Plaintext

; --------------------------------------------------------------------------------
; @Title: Wrapper script for command WinPOS
; @Description:
; When using WinPOS to place a TRACE32 child window in percentage value AND
; some of the parameters of WinPOS should be omitted, you might stumble over the
; fact WinPOS behave slightly different for build 72658 (2016-05-02) and newer.
;
; By calling WinPOS via this script, all versions of TRACE32 can use the
; same syntax.
;
; Usage:
; DO ~~/winpos.cmm [<pos>],[<size>],[<scale>],[<wname>] [<state>] ["<header>"]
; with
; pos : [<left>],[<up>]
; size : [<width>],[<height>]
; scale: [<hscale>],[<vscale>]
;
; You must separate the first 6 parameters (pos,size,scale) with commas!
;
; Example 1 (works on all versions of TRACE32):
; DO ~~/demo/practice/winpos.cmm 0%,0%,50%,50%,,,List
; Data.dump VM:0
;
; Example 2 (requires TRACE32 build.12560 (2008-03-24) or higher):
; ON CMD WinPOS2 DO "~~/demo/practice/winpos.cmm"
; WinPOS2 55%,0%,,,,,Register
; Register.view /SpotLight
;
; Example 3 (like Example 2, but works on all versions of TRACE32):
; ON CMD WinPOS2 GOSUB
; (
; PRIVATE &args
; ENTRY %LINE &args
; DO "~~/demo/practice/winpos.cmm" &args
; RETURN
; )
; WinPOS2 55%,0%,,,,,Register
; Register.view /SpotLight
;
; @Keywords: PRACTICE, WinPOS
; @Author: HLG
; @Copyright: (C) 1989-2016 Lauterbach GmbH, licensed for use with TRACE32(R) only
; --------------------------------------------------------------------------------
; $Id: winpos.cmm 13699 2018-12-21 18:36:07Z rweiss $
LOCAL &pos &state &header
ENTRY &pos &state &header
IF VERSION.BUILD()>=39759. // STRing.Replace() exists ? (and VERSION.BUILD.BASE() exists ?)
(
IF VERSION.BUILD.BASE()<72658. // WinPOS can not handle '%'-symbol correctly ?
&pos=STRing.Replace("&pos","%,","% ",0)
)
ELSE // for TRACE32 older than Nov 2012
(
LOCAL &p0 &p1 &p2 &p3 &p4 &p5 &i &sep &val &cmd
&i=0.
&sep=STRing.SCAN("&pos",",",0)
WHILE (&i<6)&&(&sep>=0)
(
&val=STRing.MID("&pos",0,&sep+1)
if STRing.FIND("&val","%")
&val=STRing.CUT("&val",-1)+" "
&cmd="&"+"p"+FORMAT.Decimal(0,&i)+"=""&val"""
&cmd
&pos=STRing.CUT("&pos",&sep+1)
&i=&i+1.
&sep=STRing.SCAN("&pos",",",0)
)
&pos="&p0&p1&p2&p3&p4&p5&pos"
)
// PRINT "WinPOS &pos &state &header"
WinPOS &pos &state &header
ENDDO