Jump to content
IGNORED

BASIC / XB Translator (TidBit)


matthew180

Recommended Posts

They seem the same to me? Prefer offline since I travel and am often without internet.

AFAIK, the web interface has the top and bottom screens, top for input, bottom for output. The application is command prompt only. What are you using when offline?

Edited by Sinphaltimus
Link to comment
Share on other sites

1. Open the windows command prompt.

 

2. Change directory path to your PHP path.

 

3. Type:

 

PHP> php -S localhost:8000

 

4. Open browser

 

5. Within browser enter URL:

 

localhost:8000/tidbit_web.php

 

Makes TIdbit work offline exactly as it does online -- in the browser. No need to ever use the online interface again. No longer dependent on the web.

 

 

 

 

Sent from my iPhone using Tapatalk

Edited by Airshack
  • Like 1
Link to comment
Share on other sites

1. Open the windows command prompt.

 

2. Change directory path to your PHP path.

 

3. Type:

 

PHP> php -S localhost:8000

 

4. Open browser

 

5. Within browser enter URL:

 

localhost:8000/tidbit_web.php

 

Makes TIdbit work offline exactly as it does online -- in the browser. No need to ever use the online interface again. No longer dependent on the web.

 

 

 

 

Sent from my iPhone using Tapatalk

 

 

You're now my short duration personal saviour for the day!

Link to comment
Share on other sites

Just as an alternative, the command-line work-flow looks like this:

 

1. edit your TidBit code.

 

2. at the command prompt, hit "up-arrow" then "enter".

 

3. copy output code to emulator and run.

 

4. goto 1.

 

 

Step 2 could also be automated depending on your editor, since many editors have the ability to run external commands.

 

Some assumptions to making this work:

 

1. php is in your path, so from anywhere at a command prompt you can type "php" and the interpreter will run.

 

2. the command line "tidbit_cmd.php" is located with your source code, or someplace that you know the path.

 

3. that you understand the command-prompt "history", i.e. hitting the "up-arrow" at the command prompt takes you back through any previous commands you have entered.

 

 

So the whole "setup" would look like this:

 

1. open your TidBit source in your favorite text editor (Textpad, Notepad++, etc.), using "source.txt" in this example.

 

2. open or create the output file (the code that TidBit will generate) in your favorite text editor, using "output.txt" in this example. If you are just starting out then this file may be empty. You will never edit this file directly, just copy the code from this file.

 

3. open a command prompt and change to whatever directory you have you TidBit source and output files in (I assume then reside in the same directory).

 

4. at the command prompt type: php <path_to_tidbit>\tidbit_cmd.php source.txt 100 10 output.txt

 

5. edit your TidBit code.

 

6. at the command prompt, hit "up-arrow" then "enter". Or, if you have a macro set up in your text editor, activate the macro.

 

7. switch to the output.txt file, your editor should be telling you it has changed. Acknowledge and accept the changes since this is the code just generated by TidBit in the previous step.

 

8. select-all and copy from ouptput.txt and paste into your emulator to run.

 

9. goto 5.

Link to comment
Share on other sites

I appreciate all that, I really do there's something about the interface I can't get away from. I don't have to worry about paths or files or anything.

 

My workflow now consists of this:

1. Execute custom batch file to launch tidbit web on local host.

2. Open np++ which auto opens my source and tidbit output.

3. Edit source.

4. Copy paste source in to tb, translate, then copy paste output in to np++ file.

5. Edit tb output (because I have commented lines that need to be executed when I copy paste into emulator.

6. Copy paste in to emulator and test.

 

This is my dream zone where everything happens within my comfort zone of happiness.

Link to comment
Share on other sites

  • 3 weeks later...
  • 7 months later...

So I'm using TIdBit a lot lately and the workflow was starting to get in my way. Yes it's faster than typing it all in on the TI, but it could be faster with the command line version.

 

It requires that you have TIdBIT set up locally

 

I've created 2 batch scripts to help speed up using it

 

You'll need to edit both to add your own paths to PHP and TIdBIT cmd.

The "compile" batch is if you're iterating on the same file, the "input compile" is if you want to do a quick compile on some code without editing the compile batch file

Open the input file

When you're ready to compile your TIdBIT code,save the source, run the compile batch file
When you run it, it copies the compiled file to clipboard, post straight to Classic 99
removes task of copying your source, clearing the web INPUT field, and pasting it, pressing translate, select output, copying output to paste in Classic 99.
Also one less window you have to have open or deal with because you're not using a browser anymore.

 

These batch files are going to save some of my sanity.

 

TIdBIT_batchfiles.zip

Edited by LASooner
  • Like 2
Link to comment
Share on other sites

I noodled some more with the batch file, and created an auto compile batch, change the paths and files in auto_compile.bat (everything in astericks below)

And when you run it, it will stay resident and check to see if you have changed the file that you specified.

 

So run the batch file, edit your tidbit code in whatever editor you use, save it, it will auto compile and get copied to your clipboard. So as long as the batch is running all you have to do is save and paste into C99

@Echo Off
Set _Delay=10
Set _Monitor=[****INPUT PATH****]\input.xb
Set _Base=%temp%\BaselineState.dir
Set _Chck=%temp%\ChkState.dir
Set _OS=6
Ver|Findstr /I /C:"Version 5">Nul
If %Errorlevel%==0 Set _OS=5 & Set /A _Delay=_Delay*1000
:_StartMon
Call :_SetBaseline "%_Base%" "%_Monitor%"
:_MonLoop
If %_OS%==5 (Ping 1.0.0.0 -n 1 -w %_Delay%>Nul) Else Timeout %_Delay%>Nul
Call :_SetBaseline "%_Chck%" "%_Monitor%"
FC /A /L "%_Base%" "%_Chck%">Nul
If %ErrorLevel%==0 Goto _MonLoop

[****PHP PATH****]\php [****TIdBIT PATH****]\tidbit_cmd.php [****INPUT PATH****]\input.xb 100 10 [****OUTPUT PATH****]\output.xb

clip < "[****OUTPUT PATH****]\output.xb"

Goto :_StartMon
:::::::::::::::::::::::::::::::::::::::::::::::::::
:: Subroutine
:::::::::::::::::::::::::::::::::::::::::::::::::::
:_SetBaseline
If Exist "%temp%\tempfmstate.dir" Del "%temp%\tempfmstate.dir"
For /F "Tokens=* Delims=" %%I In ('Dir /S "%~2"') Do (
Set _Last=%%I
>>"%temp%\tempfmstate.dir" Echo.%%I
)
>"%~1" Findstr /V /C:"%_Last%" "%temp%\tempfmstate.dir"
Goto :EOF

TIdBIT_batchfiles - auto_compile.zip

Edited by LASooner
  • Like 2
Link to comment
Share on other sites

  • 1 month later...

 

I noodled some more with the batch file, and created an auto compile batch, change the paths and files in auto_compile.bat (everything in astericks below)

And when you run it, it will stay resident and check to see if you have changed the file that you specified.

 

So run the batch file, edit your tidbit code in whatever editor you use, save it, it will auto compile and get copied to your clipboard. So as long as the batch is running all you have to do is save and paste into C99

@Echo Off
Set _Delay=10
Set _Monitor=[****INPUT PATH****]\input.xb
Set _Base=%temp%\BaselineState.dir
Set _Chck=%temp%\ChkState.dir
Set _OS=6
Ver|Findstr /I /C:"Version 5">Nul
If %Errorlevel%==0 Set _OS=5 & Set /A _Delay=_Delay*1000
:_StartMon
Call :_SetBaseline "%_Base%" "%_Monitor%"
:_MonLoop
If %_OS%==5 (Ping 1.0.0.0 -n 1 -w %_Delay%>Nul) Else Timeout %_Delay%>Nul
Call :_SetBaseline "%_Chck%" "%_Monitor%"
FC /A /L "%_Base%" "%_Chck%">Nul
If %ErrorLevel%==0 Goto _MonLoop

[****PHP PATH****]\php [****TIdBIT PATH****]\tidbit_cmd.php [****INPUT PATH****]\input.xb 100 10 [****OUTPUT PATH****]\output.xb

clip < "[****OUTPUT PATH****]\output.xb"

Goto :_StartMon
:::::::::::::::::::::::::::::::::::::::::::::::::::
:: Subroutine
:::::::::::::::::::::::::::::::::::::::::::::::::::
:_SetBaseline
If Exist "%temp%\tempfmstate.dir" Del "%temp%\tempfmstate.dir"
For /F "Tokens=* Delims=" %%I In ('Dir /S "%~2"') Do (
Set _Last=%%I
>>"%temp%\tempfmstate.dir" Echo.%%I
)
>"%~1" Findstr /V /C:"%_Last%" "%temp%\tempfmstate.dir"
Goto :EOF

 

This seems to work really well! Much easier workflow now. Thanks!

  • Like 1
Link to comment
Share on other sites

See above^^^^

 

No typing just copy and paste = user friendly and best.

Same thing I do with GPL Code on Classic99 other then I have to run the Ryte Data GPL Assembler, but I have 4 sessions going on at same time so can do multiple Classic99 projects at once all using varied drives 1 to 9.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...
On 10/3/2017 at 4:35 PM, Vorticon said:

Hi Matt.
I found an error in TidBit with the ON ERROR statement.
In the following construct

label:
ON ERROR label::INPUT #1:ANS$

label is not converted to a line number.

It's not a common construct, but I happened to need it for my robotics project...

Walid

 

Ok, looking into it now.  Can you give me a few lines of the actual code?  Also note, labels that collide with reserved words are silently ignored.

 

Link to comment
Share on other sites

Ok, the double-colon problem is now fixed, and it also fixes the problem posted in #219 above.  I have updated the download file on the first page of this post (V3.1), as well as my website.

 

Also, Vorticon, I'm not sure if you realize but you don't need the continuation operator ".." if the line ends with the double-colon.  I have not seen your tidbit code recently, but the examples you posted many moons ago showed you were still using the ":: .." syntax.

A=1 ::
B=2 ::
C=3 ::

Translates to:

A=1::B=2::C=3

You *don't* need to do this (since somewhere around 2015 or 2016 I think)

A=1 :: ..
B=2 :: ..
C=3

 

  • Like 2
Link to comment
Share on other sites

You would think this would create more XB programs that use the SUB command but the opposite seems to be the case looking at some programs output.

The entire point for SUB name-of-routine was to not use GOSUB and save stack memory being used as the same routine that finds GPL names in XB is used by SUB

Link to comment
Share on other sites

Making the SUB is up to the programmer.  All this does is translate labeled BASIC code into line-numbered BASIC code.

 

Programmers can make the SUBs just fine.  And they'll translate here just fine.  But TIdBiT doesn't take shite code and make it better--it doesn't optimize memory.   It simply allows the programmer some additional freedoms and then turns that free, numberless code and makes it runnable.  

Link to comment
Share on other sites

8 hours ago, Opry99er said:

Making the SUB is up to the programmer.  All this does is translate labeled BASIC code into line-numbered BASIC code.

 

Programmers can make the SUBs just fine.  And they'll translate here just fine.  But TIdBiT doesn't take shite code and make it better--it doesn't optimize memory.   It simply allows the programmer some additional freedoms and then turns that free, numberless code and makes it runnable.  

My point was the when you make SUB routines it makes less code and more organized to run.

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...