Skip to content

Commit

Permalink
Merge pull request #10 from vectorgraphics/msvc-support
Browse files Browse the repository at this point in the history
update msvc support
  • Loading branch information
jamievlin authored Apr 11, 2024
2 parents da0ecbd + 8b606e7 commit 9d9d67a
Show file tree
Hide file tree
Showing 29 changed files with 153 additions and 105 deletions.
29 changes: 18 additions & 11 deletions cmake-scripts/external-libs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ if (ENABLE_READLINE)
else()
message(FATAL_ERROR "curses not found; will compile without curses")
endif()

pkg_check_modules(readline IMPORTED_TARGET readline)

if (readline_FOUND)
list(APPEND ASY_STATIC_LIBARIES PkgConfig::readline)
list(APPEND ASY_MACROS HAVE_LIBREADLINE)
else ()
message(FATAL_ERROR "readline not found; will compile without libreadline")
endif()
elseif(WIN32)
find_package(unofficial-pdcurses CONFIG)
if (unofficial-pdcurses_FOUND)
Expand All @@ -133,19 +142,17 @@ if (ENABLE_READLINE)
else()
message(FATAL_ERROR "curses not found; will compile without curses")
endif()

find_package(unofficial-readline-win32 CONFIG)
if (unofficial-readline-win32_FOUND)
list(APPEND ASY_STATIC_LIBARIES unofficial::readline-win32::readline)
list(APPEND ASY_MACROS HAVE_LIBREADLINE)
else ()
message(FATAL_ERROR "readline not found; will compile without libreadline")
endif()
else()
message(FATAL_ERROR "Only supported on Unix or Win32 systems")
endif()

# libreadline
pkg_check_modules(readline IMPORTED_TARGET readline)

if (readline_FOUND)
list(APPEND ASY_STATIC_LIBARIES PkgConfig::readline)
list(APPEND ASY_MACROS HAVE_LIBREADLINE)
else ()
message(FATAL_ERROR "readline not found; will compile without libreadline")
endif()
else()
message(STATUS "libreadline disabled; will not use libreadline")
endif()
Expand Down Expand Up @@ -288,7 +295,7 @@ if (ENABLE_RPC_FEATURES)
list(APPEND ASY_STATIC_LIBARIES fmem)
list(APPEND ASYMPTOTE_INCLUDES $<TARGET_PROPERTY:fmem,INCLUDE_DIRECTORIES>)
endif()
list(APPEND ASY_MACROS HAVE_RPC_RPC_H)
list(APPEND ASY_MACROS HAVE_LIBTIRPC)


else()
Expand Down
23 changes: 9 additions & 14 deletions doc/asymptote.texi
Original file line number Diff line number Diff line change
Expand Up @@ -4424,13 +4424,13 @@ the total system cputime followed by ``S''.
@cindex inheritance
@cindex virtual functions
Much like in C++, casting (@pxref{Casts}) provides for an elegant
implementation of structure inheritance, including virtual functions:
implementation of structure inheritance, including a virtual function @code{v}:
@verbatim
struct parent {
real x;
void operator init(int x) {this.x=x;}
void virtual(int) {write(0);}
void f() {virtual(1);}
void v(int) {write(0);}
void f() {v(1);}
}
void write(parent p) {write(p.x);}
Expand All @@ -4439,8 +4439,8 @@ struct child {
parent parent;
real y=3;
void operator init(int x) {parent.operator init(x);}
void virtual(int x) {write(x);}
parent.virtual=virtual;
void v(int x) {write(x);}
parent.v=v;
void f()=parent.f;
}
Expand Down Expand Up @@ -9628,19 +9628,14 @@ produced using the @code{-f} option (or @code{outformat} setting).

@cindex @code{SVG}
@cindex @code{dvisvgm}
@cindex @code{libgs}
@cindex @code{graphic}
To produce @acronym{SVG} output, you will need @code{dvisvgm} (version
2.6.3 or later) from @url{https://dvisvgm.de}.
You might need to adjust the configuration variable @code{libgs} to
point to the location of your @code{Ghostscript} library
@code{libgs.so} (or to an empty string, depending on how
@code{dvisvgm} was configured). The 2.13.1 version (or later) of
@code{dvisvgm} can display @acronym{SVG} output (used by the
3.2.1 or later) from @url{https://dvisvgm.de},
which can display @acronym{SVG} output (used by the
@code{xasy} editor) for embedded @acronym{EPS}, @acronym{PDF},
@acronym{PNG}, and @acronym{JPEG} images included with the
@code{graphic()} function. You can optimize the generated output with
@code{settings.dvisvgmOptions="--optimize"}.
@code{graphic()} function. The generated output is optimized
with the default setting @code{settings.dvisvgmOptions="--optimize"}.

@code{Asymptote} can also produce any output format supported
by the @code{ImageMagick} @code{convert} program (version 6.3.5 or
Expand Down
9 changes: 6 additions & 3 deletions include/dec.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ class block : public runnable {
types::record *transAsFile(genv& ge, symbol id);

types::record *transAsTemplatedFile(
genv& ge, symbol id, mem::vector<absyntax::namedTyEntry*> *args
genv& ge,
symbol id,
mem::vector<absyntax::namedTyEntry*> *args,
trans::frame *parent
);

// If the block can be interpreted as a single vardec, return that vardec
Expand Down Expand Up @@ -618,7 +621,7 @@ class typeParam : public absyn {
typeParam(position pos, symbol paramSym)
: absyn(pos), paramSym(paramSym) {}

bool transAsParamMatcher(coenv &e, namedTyEntry *arg);
bool transAsParamMatcher(coenv &e, record *r, namedTyEntry *arg);

void prettyprint(ostream &out, Int indent);
};
Expand All @@ -631,7 +634,7 @@ class typeParamList : public absyn {

void add(typeParam *tp);

bool transAsParamMatcher(coenv &e, mem::vector<namedTyEntry*> *args);
bool transAsParamMatcher(coenv &e, record *r, mem::vector<namedTyEntry*> *args);

void prettyprint(ostream &out, Int indent);
};
Expand Down
3 changes: 2 additions & 1 deletion include/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ class env : public protoenv {
record *getTemplatedModule(symbol id,
string filename,
string index,
mem::vector<absyntax::namedTyEntry*> *args
mem::vector<absyntax::namedTyEntry*> *args,
trans::frame *parent
);
};

Expand Down
4 changes: 2 additions & 2 deletions include/fileio.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include "common.h"

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
#include "xstream.h"
#endif

Expand Down Expand Up @@ -642,7 +642,7 @@ class obfile : public ofile {
void writeline() {}
};

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC

class ixfile : public file {
protected:
Expand Down
12 changes: 8 additions & 4 deletions include/genv.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class genv : public gc {
// Translate a module to build the record type.
record *loadModule(symbol name, string s);
record *loadTemplatedModule(
symbol name, string s, mem::vector<absyntax::namedTyEntry*> *args
symbol id,
string filename,
mem::vector<absyntax::namedTyEntry*> *args,
trans::frame *parent
);

public:
Expand All @@ -54,10 +57,11 @@ class genv : public gc {
// Get an imported module, translating if necessary.
record *getModule(symbol name, string s);
record *getTemplatedModule(
symbol name,
string s,
symbol id,
string filename,
string sigHandle,
mem::vector<absyntax::namedTyEntry*> *args
mem::vector<absyntax::namedTyEntry*> *args,
frame *parent
);

// Uses the filename->record map to build a filename->initializer map to be
Expand Down
4 changes: 2 additions & 2 deletions include/pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "common.h"
#include "angle.h"

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
#include "xstream.h"
#endif

Expand Down Expand Up @@ -235,7 +235,7 @@ class pair : public gc {
return out;
}

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
friend xdr::oxstream& operator << (xdr::oxstream& out, pair const& v)
{
out << v.x << v.y;
Expand Down
4 changes: 2 additions & 2 deletions include/processutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "transform.h"
#include "parser.h"

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
#include "xstream.h"
#endif

Expand Down Expand Up @@ -116,7 +116,7 @@ struct processDataStruct {

terminator<std::ofstream> ofile;
terminator<std::fstream> ifile;
#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
terminator<xdr::ixstream> ixfile;
terminator<xdr::oxstream> oxfile;
#endif
Expand Down
2 changes: 1 addition & 1 deletion include/statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class statistics {
return stdev(varH,2.0);
}
double stderror() {
return stdev()/sqrt(N);
return stdev()/sqrt((double) N);
}
double median() {
if(!computeMedian) {
Expand Down
5 changes: 2 additions & 3 deletions include/symbolmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,8 @@ namespace AsymptoteLsp
ExternalRefs(ExternalRefs const& exRef) = default;
ExternalRefs& operator=(ExternalRefs const& exRef) = default;

ExternalRefs(ExternalRefs&& exRef) noexcept = default;
ExternalRefs& operator=(ExternalRefs&& exRef) noexcept = default;

// ExternalRefs(ExternalRefs&& exRef) noexcept = default;
// ExternalRefs& operator=(ExternalRefs&& exRef) noexcept = default;

void clear()
{
Expand Down
4 changes: 2 additions & 2 deletions include/triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "angle.h"
#include "pair.h"

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
#include "xstream.h"
#endif

Expand Down Expand Up @@ -332,7 +332,7 @@ class triple : virtual public gc {
}


#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
friend xdr::oxstream& operator << (xdr::oxstream& out, triple const& v)
{
out << v.x << v.y << v.z;
Expand Down
1 change: 1 addition & 0 deletions include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ struct signature : public gc {
return n >= formals.size() - numKeywordOnly;
}

friend string toString(const signature& s);
friend ostream& operator<< (ostream& out, const signature& s);

friend bool equivalent(const signature *s1, const signature *s2);
Expand Down
2 changes: 1 addition & 1 deletion include/v3dfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "common.h"

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC

#include "abs3doutfile.h"
#include "xstream.h"
Expand Down
6 changes: 3 additions & 3 deletions include/win32xdr.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#if defined(_WIN32) && defined(HAVE_RPC_RPC_H)
#if defined(_WIN32) && defined(HAVE_LIBTIRPC)
#include <cstdint>
#include <cstring>
#include <cstdio>
Expand Down Expand Up @@ -74,7 +74,7 @@ struct w32_internal_xdr_conv_fn<uint8_t>
{
return in;
}

static auto constexpr host2NetFn = identity;
static auto constexpr net2HostFn = identity;

Expand Down Expand Up @@ -165,4 +165,4 @@ bool w32_xdr_float(Win32XDR* xdrs, float* ip);
bool w32_xdr_double(Win32XDR* xdrs, double* ip);


#endif
#endif
4 changes: 2 additions & 2 deletions include/xdrcommon.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#if defined(HAVE_RPC_RPC_H)
#if defined(HAVE_LIBTIRPC)
#if defined(_WIN32)
#include "win32xdr.h"
typedef Win32XDR XDR;
Expand Down Expand Up @@ -79,4 +79,4 @@ inline bool_t xdr_u_long(XDR* __xdrs, unsigned long* __lp) {
#include <rpc/rpc.h>
#endif
#endif
#endif
#endif
2 changes: 1 addition & 1 deletion include/xstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef __xstream_h__
#define __xstream_h__ 1

#if defined(HAVE_RPC_RPC_H)
#if defined(HAVE_LIBTIRPC)

#include <cstdio>
#include <iostream>
Expand Down
4 changes: 2 additions & 2 deletions prc/include/prc/oPRCFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "writePRC.h"


#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
#include "xstream.h"
#endif

Expand Down Expand Up @@ -94,7 +94,7 @@ struct RGBAColour
friend RGBAColour operator * (const double d, const RGBAColour& a)
{ return RGBAColour(a.R*d,a.G*d,a.B*d,a.A*d); }

#ifdef HAVE_RPC_RPC_H
#ifdef HAVE_LIBTIRPC
friend xdr::oxstream& operator<<(xdr::oxstream& out, RGBAColour const& col)
{
out << (float) col.R << (float) col.G << (float) col.B << (float) col.A;
Expand Down
2 changes: 1 addition & 1 deletion resources/asymptote.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%global __python %{__python3}

Name: asymptote
Version: 2.87
Version: 2.89
Release: 1%{?dist}
Summary: Descriptive vector graphics language

Expand Down
Loading

0 comments on commit 9d9d67a

Please sign in to comment.