25 June 2021, 08:15 | #21 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
And anyway, it was worth a shot. It's not really obvious exactly what happens when you have multiple include paths that may lead to the same files, so I'm glad we got this sorted out. |
|
25 June 2021, 11:07 | #22 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
clibinstead of proto. Which results in linking stub routines from amiga.libfor all OS calls. The vbcc target headers only replace the protodirectory from the NDK, to be able to use its own assembler inline code for OS calls (which are a little bit faster than stub routines). Quote:
faroption with SAS/C and not faronly. I don't know what the difference is. Does it mean A4 must not be modified? vbcc will always save and restore A4, but on intermediate callbacks into TextEditor the register may have a different value. Not sure if such calls even exist. Quote:
An alternative, which takes a lot more time, is to insert code which tells you that it was executed. But it shouldn't be as complex as a printf(), because such a call has many dependencies which also could cause a crash. I would just replace the dc.w $cf4fby a trap #0. So you will immediately know that the instruction has been executed when a software failure #80000020appears. Then you can move the location of this breakpoint until your other crash happens, which will narrow it down in your code. You should also make your plugin as simple as possible. The init()function shouldn't do much more than initialise the highlighterHookand leave everything else NULL. The hook itself should do nothing. When this works, you can slowly start adding more code to it. |
|||
25 June 2021, 13:21 | #23 | ||
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
Quote:
__saveds is supposed to restore the value of a4 when this is called from hooks. What confuses me is that she writes Quote:
|
||
25 June 2021, 18:13 | #24 | |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
First of all great that you are trying to build a better highlighter for m68k. Much approved.
Secondly apologies for not discovering this thread and answering sooner. Quote:
|
|
25 June 2021, 18:21 | #25 | |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
Quote:
faronly means don't use a4 but you are free to use it as any other register We need it to be build with "far" so we don't trash a4 in the plugin |
|
25 June 2021, 20:32 | #26 | |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
Quote:
A4 is not used as a base register. highlightBlock isn't even referencing (or I missed it?) any variables external to highlightBlock in the example.c. (but even if it did a4 is not base register) so...what magic does a4 hold in its value? |
|
25 June 2021, 20:41 | #27 | |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
Quote:
Code:
struct ExecBase *SysBase = (*((struct ExecBase **) 4)); |
|
25 June 2021, 20:50 | #28 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
https://gitlab.com/boemann/texteditf...mple/SCOPTIONS
doesn't contain NOSTARTUP. Now I am REALLY confused. |
25 June 2021, 21:10 | #29 | |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
Quote:
The sas/c pragmas I use make it use 4 (or does it - i'm not sure anymore) But yeah Feel free to make a pullrequest for this and any other improvement to make it work with more compilers Last edited by boemann; 25 June 2021 at 21:17. |
|
26 June 2021, 10:32 | #30 | ||
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
My aim is to have the syntax highlighting look something like the C syntax highlighting in TuiTED, or like M68k does in Sublime Text (on Windows, using an M68k plugin). So I'll be differentiating between labels, instructions & their qualifiers, operands and comments to begin with. I might also highlight the registers and literal values in a second phase, and maybe also the preprocessor directives at some point. But once I get this plugin actually working properly, I'll probably start another thread about the actual implementation of the highlighting. Quote:
I probably shouldn't speak before my turn, but it doesn't look like that far/A4 thing will be the cause for the problems. So if you can think of anything else that might be causing issues with this plugin, please let us know. Any other caveats we should to be aware of when compiling/linking this? Well as suggested by phx I will first focus on getting your basic example working using VBCC. I will be testing this in WinUAE and use its debugger to try and narrow down where the problem occurs. Once I have this working, I'll gladly share my code & VBCC settings, so you can include it in your github repo. Not sure about pull requests and all that; I somehow always end up in trouble when trying to do things using git. But I'm getting ahead of myself; we'll solve that problem when it arises. |
||
26 June 2021, 10:49 | #31 |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
Okay sounds like very good goal you have there. I'm sure you will get there
The a4 thing I think is the culprit, as I had the exact same symptoms when trying to create the example and not using far but faronly. The highlighters in the OS use another buildsystem so I had to go recreate the example almost from scratch, which is why i stumbled into the problem. Also the API is not fixed so if we figure out that I need to make changes to make it work better with VBCC et al I'm all for it. The part about the hook and calling HighlightSetFormat is fixed though and the idea of the way the GUI is used is fixed too, so don't worry it will not be big changes, from a coding point of view if we do decide to change things a bit. As for contributing to that example code, yes let's wait until you are ready but please make my life as easy as possible. My time is better spent improving the OS itself |
26 June 2021, 10:55 | #32 |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
Have you tried to not do anything in the init function except setting the names. So don't set up any callback og highlighter hook and don't call any functions
It should be safe as they are all set to a safe NULL when init is called at least this should mean it will appear in the textedit menu |
26 June 2021, 11:05 | #33 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
|
|
26 June 2021, 11:13 | #34 | |
Registered User
Join Date: May 2017
Location: Belgium
Age: 50
Posts: 334
|
Quote:
Well I'll do my best. TBH I was just planning to have an example working in VBCC, next to your SAS/C example, so people at least have a choice which framework they're going to develop under. We can always look into merging those into one later. I doubt I'm the ideal person to do this kind of merging operation, TBH, but we'll see. First we'll need something worth merging. |
|
26 June 2021, 12:01 | #35 | |||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
SysBaseI wouldn't expect you to be able to call either of them. In your example SysBaseis initialised in openLibs(), which would be after AllocVec(). Quote:
SysBaseis already valid, but the Plugin Header structure will no long be at the beginning of the executable. Maybe that doesn't matter? But: would a startup-code even by executed? TextEdit probably looks for the Plugin Header and executes the init()function from there. Nothing more. Quote:
(struct ExecBase *)4directly, instead of using SysBase? This would make all exec calls unnecessarily slow, though. This morning I got a mail from somebody who seems to know some SAS/C internals and he wrote something that I would translate into: SAS/C (probably the linker) automatically generates a reference to address 4, when a reference to _SysBasecannot be resolved. Therefore you don't need to define it anywhere. He also wrote that you can define __USE_SYSBASEbefore including the exec-pragmas to force using SysBaseinstead of 4in the pragmas. Which is more in line with what you said. Anyway, this seems to be a quite compiler-specific feature and should better be avoided in public example code. Just move AllocVec()behind openLibs()and you are clean. Quote:
near)? Quote:
__savedsin the TextEdit source. Requiring that all plugin authors don't touch A4 would restrict them to use SAS/C. I'm not sure if any other compiler has a faroption which takes A4 away from the code generator. |
|||||
26 June 2021, 12:29 | #36 | |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
Quote:
But I fully agree new code shouldn't and my example in particular shouldn't expose such bad practice |
|
26 June 2021, 12:42 | #37 | |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
Quote:
|
|
26 June 2021, 13:22 | #38 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
__saveds will mess A4 in the TextEdit near model context. __saveds will rebase A4 on the plugin's variables.
Some weird workaround could be to have a dummy register a4 parameter on the hook function highlightBlock |
26 June 2021, 13:28 | #39 |
Camilla, AmigaOS Dev.
Join Date: Mar 2020
Location: Frederiksberg
Posts: 327
|
|
26 June 2021, 14:39 | #40 |
Registered User
Join Date: Dec 2010
Location: Athens/Greece
Age: 53
Posts: 719
|
__saveds makes C compiler call __geta4() or something similar (see http://franke.ms/cex/z/7736WY for gcc)
That makes a4 having a value than can address 64K data for the current project. My understanding from your previous post is that TextEdit needs A4 to point to TextEdit's variables. If you do __saveds in another C program (this plugin) you restore A4 for that program and not TextEdit. There are two different programs __saveds will restore a4 to two different values. Plugin's functions' __saveds with set A4 to say value1 and __saveds functions in TextEdit will set A4 to value2. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AmigaOS 3.2 TextEdit - black text on black background? | Warty | support.Apps | 7 | 08 June 2021 17:30 |
gedit asm syntax highlighting plugin? | grond | Coders. Asm / Hardware | 0 | 19 May 2020 13:06 |
VBCC assembler linking syntax? | NovaCoder | Coders. General | 2 | 20 May 2011 03:04 |
CLI Syntax | Greaser | New to Emulation or Amiga scene | 1 | 08 October 2006 10:14 |
SynTax Disks (old) | andreas | request.Old Rare Games | 1 | 19 July 2003 04:02 |
|
|