It is currently Mon Nov 20, 2017 5:36 pm


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: $TEXT Enhancements to Mumps V1...
PostPosted: Mon Jan 30, 2012 6:06 pm 

Joined: Tue Dec 07, 2010 3:45 am
Posts: 26
Real Name: Sam Habiel
Began Programming in MUMPS: 02 Dec 2006
I won't call them fixes because I think the standard does not specify these behaviors for $Text.

I fixed the following:
@tag+offset from within a routine now works correctly.
@tag[+offset]^@rtn now works correctly

Here's the code I used to test this:
Code:
%UT       ; SMH - Unit Test Suite for MV1
         ;;
AEQ      (C1,C2) ; Assert that C1 and C2 are equal
         I C1'=C2 S $EC=",U1,"
         Q
ANE      (C1) ; Assert that C1 is not empty
         I '$L(C1) S $EC=",U2,"
         Q
DTEXT      ; $Text
         W $T(+2^%UT),!         ; Routine Name
         W $T(+0),!             ; ditto
         W $T(^%UT),!           ; Routine Identity
         W $T(+1),!             ; First Line
         W $T(AEQ),!            ; Label Test
         W $T(AEQ^%UT),!        ; ditto
         W $T(AEQ+1),!          ; next line
         W $T(AEQ+1^%UT),!      ; ditto
         W $T(AEQ+2^%UT),!      ; next line
         W $T(AEQ+3^%UT),!      ; next line yet
         ;
         ; Indirection Tests - Part 1
         S X="+0^%UT" W $T(@X),!    ; Normal indirection
         S X="+0" W $T(@X),!    ; Ditto
         S X="^%UT" W $T(@X),!      ; More
         S X="+1" W $T(@X),!        ; More
         S X="AEQ" W $T(@X),!       ; More
         S X="AEQ+1" W $T(@X),!     ; More
         S X="AEQ+1^%UT" W $T(@X),! ; More
         S X="AEQ+2^%UT" W $T(@X),! ; More
         S X="AEQ+3^%UT" W $T(@X),! ; More
         ;
         ; Indirection Tests - Part 2 - most fail
         W $T(@""),!                    ; Not supposed to work!!
         S X="ANE" W $T(@X+1),!         ; Sam fixed this one
         S X="ANE" W $T(@X+2),!         ; Sam fixed this one
         S X="+0",Y="%UT" W $T(@X^@Y),! ; Works
         S X="AEQ",Y="%UT" W $T(@X^@Y),! ; Sam fixed this one
         S X="AEQ+1",Y="%UT" W $T(@X^@Y),! ; ditto
         W "---",!
         S X="AEQ" W $T(@X^%UT),!         ; Sam fixed this one
         S X="AEQ+1" W $T(@X^%UT),!       ; Sam fixed this one
         S Y="%UT" w $T(AEQ^@Y),!       ; Works
         S Y="%UT" w $T(AEQ+1^@Y),!     ; Works
         QUIT


Here's the output:
Code:
MCL> D DTEXT^%UT
 ;;
%UT
%UT ; SMH - Unit Test Suite for MV1
%UT ; SMH - Unit Test Suite for MV1
AEQ(C1,C2) ; Assert that C1 and C2 are equal
AEQ(C1,C2) ; Assert that C1 and C2 are equal
 I C1'=C2 S $EC=",U1,"
 I C1'=C2 S $EC=",U1,"
 Q
ANE(C1) ; Assert that C1 is not empty
%UT
%UT
%UT ; SMH - Unit Test Suite for MV1
%UT ; SMH - Unit Test Suite for MV1
AEQ(C1,C2) ; Assert that C1 and C2 are equal
 I C1'=C2 S $EC=",U1,"
 I C1'=C2 S $EC=",U1,"
 Q
ANE(C1) ; Assert that C1 is not empty
%UT
 I '$L(C1) S $EC=",U2,"
 Q
%UT
AEQ(C1,C2) ; Assert that C1 and C2 are equal
 I C1'=C2 S $EC=",U1,"
---
AEQ(C1,C2) ; Assert that C1 and C2 are equal
 I C1'=C2 S $EC=",U1,"
AEQ(C1,C2) ; Assert that C1 and C2 are equal
 I C1'=C2 S $EC=",U1,"


How do I contribute back the source code? I modified just routine.c.

Sam


Top
Offline Profile  
 
 Post subject: Re: $TEXT Enhancements to Mumps V1...
PostPosted: Mon Feb 06, 2012 8:57 am 
User avatar

Joined: Wed Nov 17, 2010 8:37 am
Posts: 136
Real Name: Terry L. Wiechmann
Began Programming in MUMPS: 0- 0-1971
These are not arbitrary constructs but, in fact, part of the 95 standard. If your have the ANSI/MDC X11.1-1995 manual, follow the entryref option for the $TEXT function (pages 40 and 47).

You will find them used extensively in File Manager as well as EsiObjects.

_________________
Terry L. Wiechmann


Top
Offline Profile  
 
 Post subject: Re: $TEXT Enhancements to Mumps V1...
PostPosted: Wed Feb 08, 2012 8:24 pm 
User avatar

Joined: Mon Nov 01, 2010 3:33 pm
Posts: 103
Location: Australia
Real Name: Ray Newman
Began Programming in MUMPS: 01 Jul 1976
Version 1.54 of MV1 incorporating Sam's fixes has been uploaded to source forge.
see https://sourceforge.net/projects/mumps/files/
Files loaded are:
mumps-1.54-FreeBSD.9.0-RELEASE.tar.gz
mumps-1.54-linux.2.6.32-33.Ubuntu.tar.gz
mumps-1.54-osx-10.7.3.tar.gz
mumps-1.54-src.tar.gz

Ray


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net