adesutherland / CREXX

REXX Language implementation
Other
13 stars 3 forks source link

RXC on value BIF returns errors. #340

Closed Peter-Jacob closed 1 year ago

Peter-Jacob commented 1 year ago
C:\Users\PeterJ\CLionProjects\CREXX0822\cmake-build-debug\compiler\rxc.exe value
Error in value.rexx @ 39:19 - #UNEXPECTED_ARGUMENT, 1, "\".\"reg\"@\""
Error in value.rexx @ 39:15 - #FUNCTION_NOT_FOUND, "pos(\".\"reg\"@\",symbol\"@\")"
Error in value.rexx @ 46:19 - #UNEXPECTED_ARGUMENT, 1, "\".\"reg\"@\""
Error in value.rexx @ 46:15 - #FUNCTION_NOT_FOUND, "pos(\".\"reg\"@\",symbol\"@\")"
Error in value.rexx @ 56:19 - #UNEXPECTED_ARGUMENT, 1, "\".\"reg\"@\""
Error in value.rexx @ 56:15 - #FUNCTION_NOT_FOUND, "pos(\".\"reg\"@\",symbol\"@\")"
6 error(s) in source file

Process finished with exit code 2

The current VALUE coding is:

/* REXX Levelb VALUE Implementation */
options levelb

namespace rxfnsb expose value

/* Only does a read (and value is always returned as a string) for the initial release */

value: procedure = .string
  arg input = .string

  if input = "" then return "" /* ? */
  result = ""
  ires = 0
  fres = 0.0
  sres = ""
  reg = lower(input)
  symbol = ""
  type = ""
  module = 0
  address = 0
  meta_array = 0
  meta_entry = ""
  v = ""
  r_num = 0

  address_object = 0
  assembler metaloadcalleraddr address_object /* Address from where are we called */
  assembler linkattr module,address_object,1  /* 1 = Module number */
  assembler linkattr address,address_object,2 /* 2 = Address in module */

  /* Read the addresses backwards */
  do a = address to 0 by -1
     /* Get the metadata for that address */
     assembler metaloaddata meta_array,module,a
     do i = 1 to meta_array
        assembler linkattr meta_entry,meta_array,i
        if meta_entry = ".meta_clear" then do /* Object type */
           assembler linkattr symbol,meta_entry,1
           if pos("."reg"@",symbol"@") > 0 then do /* TODO - Rough and ready find */
              leave a
           end
        end

        else if meta_entry = ".meta_const" then do /* Object type */
           assembler linkattr symbol,meta_entry,1
           if pos("."reg"@",symbol"@") > 0 then do /* TODO - Rough and ready find */
             assembler linkattr type,meta_entry,3
             assembler linkattr v,meta_entry,4
             result = v
             leave a
           end
        end

        else if meta_entry = ".meta_reg" then do /* Object type */
           assembler linkattr symbol,meta_entry,1
           if pos("."reg"@",symbol"@") > 0 then do /* TODO - Rough and ready find */
              assembler linkattr type,meta_entry,3
              assembler linkattr r_num,meta_entry,4

              if type = ".int" then do
                 assembler metalinkpreg ires,r_num       /* Link parent-frame-register */
                 ires_copy = ires /* Don't want to alter ires with any side effects */
                 assembler unlink ires
                 result = ires_copy
              end

              else if type = ".float" then do
                 assembler metalinkpreg fres,r_num       /* Link parent-frame-register */
                 fres_copy = fres
                 assembler unlink fres
                 result = fres_copy
              end

              else do
                 assembler metalinkpreg sres,r_num       /* Link parent-frame-register */
                 sres_copy = sres
                 assembler unlink sres
                 result = sres_copy
              end
           end
        end
     end
   end
  if result = "" then result = upper(input)

  return result
adesutherland commented 1 year ago

A change you might have missed rxc (and rxvm) now need access to the library:

e.g. from my run.sh

../cmake-build-debug/compiler/rxc -i ../cmake-build-debug/lib/rxfns $1

../cmake-build-debug/assembler/rxas $1

../cmake-build-debug/interpreter/rxvm $1 ../cmake-build-debug/lib/rxfns/library -a $2 $3 $4

Note: Program arguments after the -a

rvjansen commented 1 year ago

Peter,

you can have a look at the shell scripts in the bin directory for easy reference on how to address the library.

On 15 Jun 2023, at 17:48, Adrian Sutherland @.***> wrote:

A change you might have missed rxc (and rxvm) now need access to the library:

e.g. from my run.sh

../cmake-build-debug/compiler/rxc -i ../cmake-build-debug/lib/rxfns $1

../cmake-build-debug/assembler/rxas $1

../cmake-build-debug/interpreter/rxvm $1 ../cmake-build-debug/lib/rxfns/library -a $2 $3 $4

Note: Program arguments after the -a

— Reply to this email directly, view it on GitHub https://github.com/adesutherland/CREXX/issues/340#issuecomment-1593324024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3WJQP7KH2NIUMDNTHFTVLXLMVFLANCNFSM6AAAAAAZIARLYE. You are receiving this because you are subscribed to this thread.

Peter-Jacob commented 1 year ago

tx, got it running!