diff --git a/.gitignore b/.gitignore index 7ae3835ea6015badd0a917b1aa28339b4bef5f7d..4792cb23aadd2d4b7b3ae517aa64d83dad485ce8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ configure config.cache config.log config.status +config.h make_variables modlist_segment module.pmod @@ -13,5 +14,6 @@ sass.c *.o plib/ refdoc/ +_build/ *.css *.map diff --git a/Makefile.in b/Makefile.in index 1bfea57ad3cd66ce4bd8b62ae850252ae0ad3044..df17043e5f57ca36c51752ba068325b0ac725ecc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,6 +4,7 @@ VPATH=@srcdir@ MODNAME=Sass MODDIR=Tools.pmod/ MODULE_PMOD_IN=module.pmod.in +AUTODOC_SRC_IN=module.pmod.in sass.c MODULE_WRAPPER_PREFIX=_ MODULE_LDFLAGS=@LDFLAGS@ @LIBS@ @CMOD_LIBS@ MODULE_CFLAGS=@CMOD_CFLAGS@ @@ -14,4 +15,3 @@ OBJS=sass.o sass.o : $(SRCDIR)/sass.c @dependencies@ - diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..6df87f0373b89a525fa959b1c9e3e6646e62f14e --- /dev/null +++ b/config.h.in @@ -0,0 +1,55 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if libsass has sass_language_version() */ +#undef HAVE_LIBSASS_LANGUAGE_VERSION + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <sass.h> header file. */ +#undef HAVE_SASS_H + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS diff --git a/configure.in b/configure.in index 2ac0a2eef30eca538b862f3c11233bb23f4910c4..4632b346e5ce172fc17bc8471c3aff181b30724c 100644 --- a/configure.in +++ b/configure.in @@ -1,13 +1,25 @@ AC_INIT(sass.cmod) +AC_CONFIG_HEADERS(config.h) +# AC_ARG_WITH(sass, [ --with(out)-sass Support for SASS],[],[with_sass=yes]) AC_MODULE_INIT() +AH_TEMPLATE([HAVE_LIBSASS_LANGUAGE_VERSION], + [Define to 1 if libsass has sass_language_version()]) + CMOD_LIBS="-lsass" CMOD_CFLAGS="" +# AC_HAVE_HEADERS(sass.h) +AC_CHECK_HEADERS([sass.h]) + +# +# Check for features in libsass +# +AC_SEARCH_LIBS(sass_language_version, sass, + [ AC_DEFINE([HAVE_LIBSASS_LANGUAGE_VERSION], [1]) ]) + + AC_SUBST(CMOD_CFLAGS) AC_SUBST(CMOD_LIBS) -AC_HAVE_HEADERS(sass.h) -AC_CHECK_HEADERS(sass.h) - AC_OUTPUT(Makefile) diff --git a/module.pmod.in b/module.pmod.in index 6dd11947db433cdd2394c852265d9a73fc5e52a1..6c7288bcd1d13173c2c3f938356deb569399dca6 100644 --- a/module.pmod.in +++ b/module.pmod.in @@ -18,7 +18,7 @@ class SCSS { inherit Tools@module@._Api; - //! Set options to the SASS compiler + //! Set options to the SASS compiler. @[opts] //! //! @param opts //! @mapping @@ -97,4 +97,13 @@ class SCSS } } } + + // //! Test if @[set_options()] will be linked to from @[a]? + // //! + // //! @param a + // //! Just a parameter + // void test_func(mapping a) + // { + // return a; + // } } diff --git a/sass.cmod b/sass.cmod index 961506097e67e86bf779c240791c4ac2a3c5ab1a..df763865e3c2fbb21b424424bb884c2504cc039c 100644 --- a/sass.cmod +++ b/sass.cmod @@ -5,7 +5,7 @@ */ #include <sass.h> - +#include "config.h" #include "global.h" #include "interpret.h" #include "module.h" @@ -24,7 +24,8 @@ DECLARATIONS /*! @module Tools */ -/*! @module Sass +/*! @module _Sass + *! Low level module of @[Tools.Sass] */ // #define SASS_DEBUG @@ -79,6 +80,11 @@ void set_options (sass_opts *opts, struct Sass_Context *ctx) } } + +/*! @class _Api + *! + *! Base class and stuff + */ PIKECLASS _Api { // CVAR sass_object *sobj; @@ -86,10 +92,10 @@ PIKECLASS _Api /*! @decl void set_include_path(string path) *! - *! Set include path of @tt{@imports@} + *! Set include path of @tt{imports@} *! *! @seealso - *! get_include_path() + *! @[get_include_path()] *! *! @param path */ @@ -106,10 +112,10 @@ PIKECLASS _Api /*! @decl string get_include_path() *! - *! Get include path of @tt{@imports@} + *! Get include path of @tt{imports@} *! *! @seealso - *! set_include_path() + *! @[set_include_path()] */ PIKEFUN string get_include_path () { @@ -177,6 +183,7 @@ PIKECLASS _Api RETURN (THIS->options->comments); } + /*! @decl void set_source_map_file(string path) *! *! Path to source map file. Enables the source map generating. @@ -212,7 +219,7 @@ PIKECLASS _Api push_text (f); } else { - push_int (0); + push_undefined (); } } @@ -232,6 +239,7 @@ PIKECLASS _Api THIS->options->map_embed = embed; } + /*! @decl bool get_source_map_embed() *! *! Will a source map be embedded or not? @@ -274,7 +282,7 @@ PIKECLASS _Api push_text (THIS->options->map_root); } else { - push_int (0); + push_undefined (); } } @@ -312,7 +320,7 @@ PIKECLASS _Api /*! @decl void set_precision(int(0..) p) *! - *! Set the precision of fractional numbers. Default is @{5}. + *! Set the precision of fractional numbers. Default is @tt{5@}. *! *! @seealso *! @[get_precision()] @@ -480,11 +488,50 @@ PIKECLASS _Api free (THIS->options); } } +/*! @endclass */ + +/*! @decl string libsass_version() + *! + *! Returns the @tt{libsass@} version this module was compiled against + */ +PIKEFUN string libsass_version() +{ + const char* v = libsass_version(); + push_string (make_shared_string (v)); +} + +/*! @decl string sass2scss_version() + *! + *! Returns the @tt{sass2scss@} version this module was compiled against + */ +PIKEFUN string sass2scss_version() +{ + const char* v = sass2scss_version(); + push_string (make_shared_string (v)); +} + +#if HAVE_LIBSASS_LANGUAGE_VERSION +/* Returns the @tt{language@} version of Sass this module was compiled against +*/ +PIKEFUN string libsass_language_version() +{ + const char* v = libsass_language_version(); + push_string (make_shared_string (v)); +} +#endif PIKE_MODULE_INIT { add_string_constant ("LIBSASS_VERSION", LIBSASS_VERSION, 0); + /*! @decl constant STYLE_NESTED + *! @decl constant STYLE_EXPANDED + *! @decl constant STYLE_COMPACT + *! @decl constant STYLE_COMPRESSED + *! + *! Styling of output. Use as argument to @[set_output_style()] + */ + add_integer_constant ("STYLE_NESTED", SASS_STYLE_NESTED, 0); add_integer_constant ("STYLE_EXPANDED", SASS_STYLE_EXPANDED, 0); add_integer_constant ("STYLE_COMPACT", SASS_STYLE_COMPACT, 0); diff --git a/simple-test/test.pike b/simple-test/test.pike index 1c9d5ffd1a7c03febb82619be104bfd1cbe26075..64074c50fbd207868c2a31ebc16d49a20e2e6ce1 100644 --- a/simple-test/test.pike +++ b/simple-test/test.pike @@ -5,6 +5,12 @@ constant BASE = __DIR__; int main(int argc, array(string) argv) { + if (argc > 1 && argv[1] == "v") { + write("libsass version: %s\n", Tools.Sass.libsass_version()); + write("sass2scss version: %s\n", Tools.Sass.sass2scss_version()); + return 0; + } + compiler = Tools.Sass.SCSS(); compiler->set_options(([ "output_style" : Tools.Sass.STYLE_EXPANDED