orangeduck/BuildYourOwnLisp

editline includes on OS X

Closed this issue · 3 comments

The header editline/history does not exist on OS X. Including editline/readline seems to suffice.

A minimal, hacky fix would be to rewrite the #else branch of #ifdef _WIN32 to :

#ifdef _WIN32
//All the win-specific stuff
#else
#include <editline/readline.h>

#ifndef __APPLE__
#include <editline/history.h>
#endif
#endif

which fixes it for me(OS X 10.10).

I think this header may be required on some older versions of OS X - but I'm not certain so I'll try to look into it a bit more.

I'm not sure about this, but I think I recall editline being broken at least since 10.8. Before that, I only know that there have been some problems with Rubys/Pythons REPLs, because the editline compatibility layer does not seem to be fully compatible with readline.

You could do this, but it feels very clumsy and will not be as nice and easy to grasp for learners; it seems to work for me as well:

#ifdef _WIN32

/* Win-specific */

#else

#include <editline/readline.h>

#ifdef __APPLE__

#include <AvailabilityMacros.h>

#if !(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
#include <editline/history.h>
#endif

#else
#include <editline/history.h>
#endif
#endif