MEGA65 / mega65-libc

Simple C library for the MEGA65
Other
25 stars 20 forks source link

Put header files in a subdirectory? #31

Closed mlund closed 1 year ago

mlund commented 1 year ago
          Would it be a good idea to put the header files in a subdirectory to make it more clear that the file belongs to mega65?
#include <mega65/memory.h>

The idea is that it avoids clashes and makes it more clear to which system the header file belongs to. It is especially helpful if source files using the #include is shared between multiple systems, e.g. shared with systems other than MEGA65.

_Originally posted by @hth313 in https://github.com/MEGA65/mega65-libc/pull/29#discussion_r1267343503_

mlund commented 1 year ago

I like the idea, but dependent programs would need to be updated. Users could also use a mega65.h header that includes everything.

lydon42 commented 1 year ago

I also like the idea... after changing freeze_sprited.c it looks like this:

#include <cc65.h>
#include <conio.h>
#include <mouse.h>
#include <hal.h>
#include <cbm.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include "freezer.h"

and before it was:

#include <cc65.h>
#include "../mega65-libc/cc65/include/conio.h"
#include "../mega65-libc/cc65/include/mouse.h"
#include "../mega65-libc/cc65/include/hal.h"
#include <cbm.h>
#include <stdio.h>
#include <stdlib.h>
#include "../mega65-libc/cc65/include/memory.h"
#include "freezer.h"

easy to get confused here... this would look more intuitive:

#include <cc65.h>
#include <mega65/conio.h>
#include <mega65/mouse.h>
#include <mega65/hal.h>
#include <cbm.h>
#include <stdio.h>
#include <stdlib.h>
#include <mega65/memory.h>
#include "freezer.h"
lydon42 commented 1 year ago

Actually compatibility is already broken:

So anyone using libc already needs to change. So we should add mega65 subdir to include right now in my opinion.

mlund commented 1 year ago

Actually compatibility is already broken:

  • Makefile was renamed to Makefile_cc65
  • libmega65.c was moved
  • include dir was moved

So anyone using libc already needs to change. So we should add mega65 subdir to include right now in my opinion.

For projects not ready to change, one could also just checkout tag v0.2.0 which is the library state just before the restructuring.