SAS/C options to gcc & Ralph Bablel's WBPath

4 posts / 0 new
Last post
JosDuchIt
JosDuchIt's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2012-01-08 20:57
SAS/C options to gcc & Ralph Bablel's WBPath

How do i translate rhe instuctions in SCOPTIONS file to gcc commandline?

PARAMETERS=REGISTERS
NOSTACKCHECK
STRINGMERGE
NOMULTIPLEINCLUDES
OPTIMIZE
LIBRARY=wbpath.o
LINK
SMALLCODE
SMALLDATA
STARTUP=cres
NOSTANDARDIO

The file to compile is
gui.c
which has an include for "wbpath.h"
wbpath.h & wbpath.o are both in the same drawer as gui.c
gui.c does use findpath.c function which i did find in a TEXLive AROS archive on Aminet.
wbpath is on Aminet and in developer CD V2.1
I managed to do this

3.Datas:Gui4Cli/Dev/Gui/GUI_SRC> gcc -c findpath.c
3.Datas:Gui4Cli/Dev/Gui/GUI_SRC> gcc -c gui.c
3.Datas:Gui4Cli/Dev/Gui/GUI_SRC> gcc gui.o findpath.o wbpath.o -o gui_OS4
wbpath.o: file not recognized: File format not recognized

I guess that's because wbpath.o was compiled for 68k

Dis somebody get hold of wbpath.c or does somebody know af a replacement for wbpatn ?

Belxjander
Belxjander's picture
Offline
Last seen: 8 years 4 months ago
Joined: 2011-02-25 11:53
Yes the file format is

Yes the file format is different but more to do with GCC being ported from *n*x OS

There are some other options that change as well

thomas
thomas's picture
Offline
Last seen: 1 week 3 days ago
Joined: 2011-05-16 14:23
Here is a C translation I

Here is a C translation I once made from a disassembly of the wbpath.o module:

  1. #define __NOLIBBASE__
  2. #define __USE_SYSBASE
  3. #include <proto/exec.h>
  4. #include <proto/dos.h>
  5. #include <workbench/startup.h>
  6.  
  7. struct PathNode {
  8. BPTR pn_Next;
  9. BPTR pn_Lock;
  10. };
  11.  
  12. BPTR cloneWorkbenchPath (struct Library *SysBase, struct Library *DOSBase, struct WBStartup *sm)
  13.  
  14. {
  15. BPTR newpath = (BPTR)0;
  16. struct MsgPort *port;
  17. struct Process *pr;
  18.  
  19. Forbid();
  20.  
  21. if (port = sm->sm_Message.mn_ReplyPort)
  22. if ((port->mp_Flags & PF_ACTION) == PA_SIGNAL)
  23. if ((pr = (struct Process *)port->mp_SigTask)->pr_Task.tc_Node.ln_Type == NT_PROCESS)
  24. {
  25. struct CommandLineInterface *cli = BADDR(pr->pr_CLI);
  26. BPTR pathnode = cli->cli_CommandDir;
  27. BPTR *last = &newpath;
  28.  
  29. while (pathnode)
  30. {
  31. BPTR checkpn = cli->cli_CommandDir;
  32.  
  33. while (checkpn)
  34. {
  35. if (checkpn == pathnode)
  36. break;
  37.  
  38. checkpn = ((struct PathNode *)BADDR(checkpn))->pn_Next;
  39. }
  40.  
  41. if (checkpn)
  42. {
  43. struct PathNode *pn = BADDR(pathnode);
  44. BPTR lock;
  45. ULONG *mem;
  46.  
  47. pathnode = pn->pn_Next;
  48.  
  49. if (!(lock = DupLock (pn->pn_Lock)))
  50. break;
  51.  
  52. if (mem = AllocMem (sizeof(ULONG)+sizeof(struct PathNode),MEMF_PUBLIC))
  53. {
  54. *mem = sizeof(ULONG)+sizeof(struct PathNode);
  55. pn = (struct PathNode *)(mem + 1);
  56. pn->pn_Next = NULL;
  57. pn->pn_Lock = lock;
  58. *last = MKBADDR(pn);
  59. last = &pn->pn_Next;
  60. }
  61. else
  62. {
  63. UnLock (lock);
  64. break;
  65. }
  66. }
  67. }
  68. }
  69.  
  70. Permit();
  71.  
  72. return (newpath);
  73. }
  74.  
  75. void freeWorkbenchPath (struct Library *SysBase, struct Library *DOSBase, BPTR PathNode)
  76.  
  77. {
  78. while (PathNode)
  79. {
  80. struct PathNode *pn = BADDR(PathNode);
  81. ULONG *mem = ((ULONG *)pn)-1;
  82. PathNode = pn->pn_Next;
  83. UnLock (pn->pn_Lock);
  84. FreeMem (mem,*mem);
  85. }
  86. }

Don't know if it compiles with GCC, though. It does with Dice C and VBCC.

JosDuchIt
JosDuchIt's picture
Offline
Last seen: 7 years 5 months ago
Joined: 2012-01-08 20:57
@Thomas Many thanks Only

@Thomas
Many thanks
Only struct PathNode is redefined,
Compiles perfectly

Log in or register to post comments