Page 1 of 1

Emacs Programming

Posted: Sat Jun 06, 2020 1:55 pm
by Derek_Stewart
Hi,

I have been using Emacs on QPC2/SMSQMulator to write DBAIS programmes, is the a way to use the QD/DBAS thing from Emacs?

Up to now I edit the SBASIC programme, save it and LRU N in SBASIC, is there a better way, SSB maybe?

Re: Emacs Programming

Posted: Sun Jun 07, 2020 11:04 pm
by swensont
I don't know a way of using some Things from MicroEmacs. There is a way of using MicroEmacs and SSB so that, from within MicroEmacs, you can fire off SSB and then a compiler. SSBGO is an executable that can be executed from MicroEmacs. It runs the code through SSB, loads it into SuperBasic, checks for any MISTakes, and then executes a compiler. Then the user can execute the compiled program from within MicroEmacs to test it.

SSB can be used with Make, and then have MicroEmacs execute Make to run SSB and then compile it.

A pdf of the SSB documentation can be found here:

http://swensont.epizy.com/SSB.pdf

Tim

Re: Emacs Programming

Posted: Mon Jun 08, 2020 2:46 pm
by mk79
Derek_Stewart wrote:I have been using Emacs on QPC2/SMSQMulator to write DBAIS programmes, is the a way to use the QD/DBAS thing from Emacs?
QD/SBAS is very closely coupled to QD, it would be very difficult to make it work with any other editor.

Re: Emacs Programming

Posted: Mon Jun 08, 2020 3:51 pm
by Derek_Stewart
Hi,

I know about QD/SBAS, which works quite nicely, I tend to use QD for most SBASIC programming.

But how do I compile an SBASIC programme in QD?

Re: Emacs Programming

Posted: Mon Jun 08, 2020 4:58 pm
by Artificer
But how do I compile an SBASIC programme in QD?
I use the QBASIC thing installed in QD instead of the SBAS thing. It works off the F10 key in the same way and will fire up QLib to compile. I don't know of a way to have both things available simultaneously in QD.

Cheers

Re: Emacs Programming

Posted: Tue Jun 09, 2020 6:16 pm
by Derek_Stewart
Artificer wrote:
But how do I compile an SBASIC programme in QD?
I use the QBASIC thing installed in QD instead of the SBAS thing. It works off the F10 key in the same way and will fire up QLib to compile. I don't know of a way to have both things available simultaneously in QD.

Cheers
Hi,

Thank you for the information.

QBASIC is a commerical programme by Jochen Merz Software, which not available for purchase.

Re: Emacs Programming

Posted: Tue Jun 09, 2020 9:14 pm
by pjw
Hi Derek,
The following might work for you:

Code: Select all

10 REMark $$chan=4
11 :
12 REMark + ---------------------------------------------------- +
13 REMark |<                   SBasic to Obj                    >|
14 REMark + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
15 REMark | Converts SBasic programs to a Q_Liberator object     |
16 REMark | file using the QLib compiler                         |
17 REMark |                                                      |
18 REMark | Adds line numbers to numberless code via intermed-   |
19 REMark | iary file in a temporary directory                   |
20 REMark |                                                      |
21 REMark | Add to FileInfo2, Hotkey, or use with EX:            |
22 REMark |                                                      |
23 REMark | er = FEW(<sb2obj>;"<program>_bas [;<command_line>]") |
24 REMark |                                                      |
25 REMark | sb2obj passes the optional <command_line> to QLib    |
26 REMark | Use this to supply standard QLib cmdl parameters     |
27 REMark | (see Q_Liberator manual), except the file name.      |
28 REMark |                                                      |
29 REMark | Version 1.02, pjw, 2oi5, SBASIC only!                |
30 REMark + ---------------------------------------------------- +
31 :
32 REMark       Config:
33 qlb$ = 'win2_bas_qlib_obj': REMark QLib
34 out$ = '': REMark Default html output = input directory
35 tmp$ = 'ram1_sbhtmxxx': REMark Location and name of temp file
36 first% = 1: step% = 1: REMark First line and step size
37 :
38 REMark       Get input file name
39 REMark Get it either from cmdl or from Stufferbuffer
40 l% = LEN(CMD$)
41 IF l% = 0 THEN
42  fnm$ = HOT_GETSTUFF$: l% = LEN(fnm$)
43 ELSE
44  fnm$ = CMD$
45 END IF
46 IF l% < 9: Bye -12
47 :
48 REMark       Process command line(s)
49 com$= ''
50 REMark Additional command line?
51 s% = ';' INSTR fnm$
52 IF s% THEN
53  IF s% < l%: com$ = fnm$(s% + 1 TO l%)
54  l% = s% - 1: fnm$ = fnm$(1 TO l%)
55 END IF
56 :
57 :
58 REMark       Extract name and dir from file name
59 ci = FOP_DIR(fnm$): IF ci < 0: Bye ci
60 dir$ = FNAME$(#ci): CLOSE#ci
61 ci = FOP_IN(fnm$): IF ci < 0: Bye ci
62 ld% = len(dir$)
63 if out$ = '' then
64  out$ = fnm$(1 to 5) & dir$
65  if ld%: out$ = out$ & '_'
66 endif
67 nm$ = fnm$(6 + (ld% > 0) + ld% TO l% - 4)
68 :
69 REMark       Filter by extension
70 IF fnm$(l% - 2 TO l%) == 'sav' THEN
71  REMark _sav files pass straight through
72  bas = 0
73  CLOSE#ci
74 ELSE
75  REMark _bas file w/wo line number
76  IF fnm$(l% - 2 TO l%) == 'bas' THEN
77   bas = 1
78  ELSE
79   REMark Wrong file type
80   Bye -15
81  END IF
82  :
83  REMark Line numbers or not?
84  INPUT#ci; l$
85  IF NOT l$(1) INSTR '123456789' THEN
86   :
87   REMark     Process line numberless file
88   fnm$ = tmp$ & '_bas'
89   co = FOP_OVER(fnm$): IF co < 0: Bye co
90   bas = 2: i% = first%: lno$ = i%
91   BPUT#co; lno$, 32, l$, 10
92   :
93   FOR i% =  first% + step% TO 32767 STEP step%
94    IF EOF(#ci): EXIT i%
95    INPUT#ci; l$: lno$ = i%
96    BPUT#co; lno$, 32, l$, 10
97   END FOR i%
98   CLOSE#co
99  END IF
100  CLOSE#ci
101  :
102  REMark     Process non-sav files
103  REMark Use SBasic daughter to tokenise program
104  pip$ = 'pipe_p' & HEX$(JOBID, 32)
105  co = FOPEN(pip$ & 'o_2048'): IF co < 0: Bye co
106  :
107  REMark Slave will take instructions from here
108  cm$ = 'ci = fop_in(#0; "' & pip$ & 'o")'
109  :
110  REMark Plumb in to SBASIC Thing
111  EXEP 'SBASIC'; cm$
112  :
113  REMark Tell it what we want
114  PRINT#co; 'load "' & fnm$ & '"'
115  PRINT#co; 'qsave_o "' & tmp$ & '"'
116  PRINT#co; 'beep 2,2: beep 2,2': REMark Signal success
117  PRINT#co; 'quit': REMark Job done! Get rid of slave
118  fnm$ = tmp$ & '_sav'
119 END IF
120 :
121 REMark      Create QLib command line
122 com$ = fnm$ & ' -OBJ ' & out$ & nm$ & ' -NAME ' & nm$ &' '& com$
123 IF bas = 2: com$ = com$ & ' -NOLINE'
124 :
125 REMark      Compile!
126 Bye FEW(qlb$; com$)
128 :
129 REMark      Tidy and quit
130 DEFine PROCedure Bye(er)
131 beep 2,2: rem Wake up QPC sound
132 IF er < 0: BEEP 3000,255: else: beep 2, 2
133 :
134 REMark Remove any temporary files
135 IF bas: DELETE fnm$
136 IF bas = 2: DELETE tmp$ & '_bas'
137 QUIT er
138 END DEFine Bye
Make changes according to your setup, compile and add to FileInfo2 or a Hotkey (eg using the Stuffer buffer as the filename input..) Its a bit crude, but it works for me..

Re: Emacs Programming

Posted: Wed Jun 10, 2020 8:52 am
by Derek_Stewart
Hi Per,

I will give it go, thank you for the solution to this.

Is it possible to make Qliberator when loaded as a Thing to accept a S*Basic file for compilation, something line: EXEP QLIB;compile$

I know this is not possible, but since the source code to Qliberator has been decompiled, maybe this option could be implemented.

Re: Emacs Programming

Posted: Wed Jun 10, 2020 12:52 pm
by BSJR
Derek_Stewart wrote:Hi Per,

I will give it go, thank you for the solution to this.
Is it possible to make Qliberator when loaded as a Thing to accept a S*Basic file for compilation, something line: EXEP QLIB;compile$
I know this is not possible, but since the source code to Qliberator has been decompiled, maybe this option could be implemented.
Another (now free) favourite option that I use, is BasicLinker by Wolfgang Lenerz.
This can take my numberless SBasic program (_bsl) and parse it, number it and even correctly number RESTORE commands.
It makes _bas and _sav files and calls QLib to create the object. If Basic errors are found it can open QD at the faulty line.
You need to make a control text file and can tell it to just parse or do it all automatically.

BSJR

Re: Emacs Programming

Posted: Wed Jun 10, 2020 3:01 pm
by Derek_Stewart
Hi Bob,

Thank you for the information, I forgot about Basic Linker. This sounds a good option.

I like the fact numberless programmes can be used.