The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What's wrong with this? (*solved*)
#4
I've tried that. The compiler crashes on the assignment. It doesn't like it.

Code:
Sub Fastcall tdPutChar (c as uByte) Asm rst 16 End Asm End Sub Sub tdPrint (cad As String) Dim i As uByte Dim c As uByte For i = 1 To Len (cad) c = cad (i) tdPutChar (c) Next i End Sub

Output:

Code:
H:\Dev\Speccy\mt64x32lib\zxbasic>c:\zxb\zxb textdongle.bas Traceback (most recent call last): File "zxb.py", line 312, in <module> File "zxb.py", line 241, in main File "ply\yacc.pyc", line 263, in parse File "ply\yacc.pyc", line 710, in parseopt File "zxbparser.pyc", line 1793, in p_assignment File "zxbparser.pyc", line 1019, in make_typecast File "obj\errmsg.pyc", line 23, in syntax_error TypeError: %d format: a number is required, not NoneType

The problem has to be the cad (i) thing. Any other way to access a single char within a string?

EDIT: I've found "mid$" inside string.bas in the library. If I take just that function and add it to my code, replacing the cad (i) for mid (cad, i, 1), I still get the same crash, but inside the mid$ function.

Code:
function mid$ (ByVal s$, ByVal x As Uinteger, ByVal n As Uinteger) return s$(x to x + n - 1) end function

Broken compiler?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)