pax_global_header00006660000000000000000000000064130570643320014515gustar00rootroot0000000000000052 comment=5909ba5b7c68ca99ef8dc1414442634fda9e4819 sassc-3.4.5/000077500000000000000000000000001305706433200126425ustar00rootroot00000000000000sassc-3.4.5/.editorconfig000066400000000000000000000003631305706433200153210ustar00rootroot00000000000000root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false [*.vcxproj,*.vcxproj.filter,*.sln] end_of_line = crlf sassc-3.4.5/.gitignore000066400000000000000000000007541305706433200146400ustar00rootroot00000000000000a.out .DS_Store Makefile.in .deps/ /aclocal.m4 /autom4te.cache/ /config.guess /config.h /config.h.in /config.log /config.status /config.sub /configure /depcomp /install-sh /libtool /ltmain.sh /m4/libtool.m4 /m4/ltoptions.m4 /m4/ltsugar.m4 /m4/ltversion.m4 /m4/lt~obsolete.m4 /missing /stamp-h1 /compile /sassc # Build stuff *.o *.gem *.res *.o *.lo *.so *.dll *.a *.suo *.sdf *.opensdf a.out libsass.js tester tester.exe build/ config.h.in* lib/pkgconfig/ .sass-cache *.user *.db *.opendb sassc-3.4.5/.travis.yml000066400000000000000000000006731305706433200147610ustar00rootroot00000000000000language: cpp sudo: false compiler: - gcc - clang env: global: - SASS_LIBSASS_PATH=$TRAVIS_BUILD_DIR/libsass matrix: - AUTOTOOLS=no BUILD=shared - AUTOTOOLS=no BUILD=static - AUTOTOOLS=yes BUILD=shared - AUTOTOOLS=yes BUILD=static before_install: - gem install sass - git clone https://github.com/sass/libsass.git script: - ./script/ci-build-libsass after_success: - ./bin/sassc -v - ldd ./bin/sassc sassc-3.4.5/LICENSE000066400000000000000000000023621305706433200136520ustar00rootroot00000000000000 Copyright (C) 2012-2016 by the Sass Open Source Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. The following files in the spec were taken from the original Ruby Sass project which is copyright Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein and under the same license. sassc-3.4.5/Makefile000066400000000000000000000121031305706433200142770ustar00rootroot00000000000000CC ?= gcc CXX ?= g++ RM ?= rm -f CP ?= cp -a CHDIR ?= chdir MKDIR ?= mkdir WINDRES ?= windres INSTALL ?= install CFLAGS ?= -Wall CXXFLAGS ?= -Wall LDFLAGS ?= -Wall ifneq "$(COVERAGE)" "yes" CFLAGS += -O2 CXXFLAGS += -O2 LDFLAGS += -O2 endif LDFLAGS += -Wl,-undefined,error CAT ?= $(if $(filter $(OS),Windows_NT),type,cat) # If you run this under windows cmd.com interpreter: # You must provide UnxUtils rm.exe and cp.exe in path # Otherwise certain targets may not work as intended! # Note: It seems impossible to replace `mkdir` command ifneq (,$(findstring /cygdrive/,$(PATH))) UNAME := Cygwin TARGET := Windows else ifneq (,$(findstring Windows,$(PATH))) UNAME := Windows TARGET := Windows else ifneq (,$(findstring mingw32,$(MAKE))) UNAME := MinGW TARGET := Windows else ifneq (,$(findstring MINGW32,$(shell uname -s))) UNAME = MinGW TARGET := Windows else UNAME := $(shell uname -s) TARGET := $(shell uname -s) endif endif endif endif ifeq ($(SASS_SASSC_PATH),) SASS_SASSC_PATH = $(abspath $(CURDIR)) endif ifeq ($(SASS_LIBSASS_PATH),) SASS_LIBSASS_PATH = $(abspath $(CURDIR)/..) endif ifeq ($(SASSC_VERSION),) ifneq ($(wildcard ./.git/ ),) SASSC_VERSION ?= $(shell git describe --abbrev=4 --dirty --always --tags) endif endif ifeq ($(SASSC_VERSION),) ifneq ($(wildcard VERSION),) SASSC_VERSION ?= $(shell $(CAT) VERSION) endif endif ifneq ($(SASSC_VERSION),) CFLAGS += -DSASSC_VERSION="\"$(SASSC_VERSION)\"" CXXFLAGS += -DSASSC_VERSION="\"$(SASSC_VERSION)\"" endif # enable mandatory flag ifeq (Windows,$(TARGET)) ifneq ($(BUILD),shared) STATIC_ALL ?= 1 endif STATIC_LIBGCC ?= 1 STATIC_LIBSTDCPP ?= 1 CXXFLAGS += -std=gnu++0x LDFLAGS += -std=gnu++0x else STATIC_ALL ?= 0 STATIC_LIBGCC ?= 0 STATIC_LIBSTDCPP ?= 0 CXXFLAGS += -std=c++0x LDFLAGS += -std=c++0x endif ifneq ($(SASS_LIBSASS_PATH),) CFLAGS += -I $(SASS_LIBSASS_PATH)/include CXXFLAGS += -I $(SASS_LIBSASS_PATH)/include # only needed to support old source tree # we have moved the files to src folder CFLAGS += -I $(SASS_LIBSASS_PATH) CXXFLAGS += -I $(SASS_LIBSASS_PATH) else # this is needed for mingw CFLAGS += -I include CXXFLAGS += -I include endif ifneq ($(EXTRA_CFLAGS),) CFLAGS += $(EXTRA_CFLAGS) endif ifneq ($(EXTRA_CXXFLAGS),) CXXFLAGS += $(EXTRA_CXXFLAGS) endif ifneq ($(EXTRA_LDFLAGS),) LDFLAGS += $(EXTRA_LDFLAGS) endif LDLIBS = -lm ifneq ($(BUILD),shared) LDLIBS += -lstdc++ endif # link statically into lib # makes it a lot more portable # increases size by about 50KB ifeq ($(STATIC_ALL),1) LDFLAGS += -static endif ifeq ($(STATIC_LIBGCC),1) LDFLAGS += -static-libgcc endif ifeq ($(STATIC_LIBSTDCPP),1) LDFLAGS += -static-libstdc++ endif ifeq ($(UNAME),Darwin) CFLAGS += -stdlib=libc++ CXXFLAGS += -stdlib=libc++ LDFLAGS += -stdlib=libc++ endif ifneq (Windows,$(TARGET)) ifneq (FreeBSD,$(UNAME)) ifneq (OpenBSD,$(UNAME)) LDFLAGS += -ldl LDLIBS += -ldl endif endif endif ifneq ($(BUILD),shared) BUILD = static endif ifeq (,$(PREFIX)) ifeq (,$(TRAVIS_BUILD_DIR)) PREFIX = /usr/local else PREFIX = $(TRAVIS_BUILD_DIR) endif endif SOURCES = sassc.c LIB_STATIC = $(SASS_LIBSASS_PATH)/lib/libsass.a LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.so RESOURCES = SASSC_EXE = bin/sassc ifeq (Windows,$(TARGET)) RESOURCES = libsass.res SASSC_EXE = bin/sassc.exe ifeq (shared,$(BUILD)) CFLAGS += -D ADD_EXPORTS CXXFLAGS += -D ADD_EXPORTS LIB_SHARED = $(SASS_LIBSASS_PATH)/lib/libsass.dll endif else CFLAGS += -fPIC CXXFLAGS += -fPIC LDFLAGS += -fPIC endif OBJECTS = $(SOURCES:.c=.o) SPEC_PATH = $(SASS_SPEC_PATH) all: sassc sassc: $(SASSC_EXE) $(SASSC_EXE): libsass build-$(BUILD) $(DESTDIR)$(PREFIX)/: $(MKDIR) $(DESTDIR)$(PREFIX) $(DESTDIR)$(PREFIX)/bin/: $(MKDIR) $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/bin/%: bin/% $(INSTALL) -D -v -m0755 "$<" "$@" install: $(DESTDIR)$(PREFIX)/$(SASSC_EXE) build-static: $(RESOURCES) $(OBJECTS) $(LIB_STATIC) $(CC) $(LDFLAGS) -o $(SASSC_EXE) $^ $(LDLIBS) build-shared: $(RESOURCES) $(OBJECTS) $(LIB_SHARED) $(CC) $(LDFLAGS) -o $(SASSC_EXE) $^ $(LDLIBS) $(CP) $(LIB_SHARED) bin/. $(LIB_STATIC): libsass-static $(LIB_SHARED): libsass-shared libsass: libsass-$(BUILD) libsass-static: ifdef SASS_LIBSASS_PATH $(MAKE) BUILD="static" -C $(SASS_LIBSASS_PATH) else $(error SASS_LIBSASS_PATH must be defined) endif libsass-shared: ifdef SASS_LIBSASS_PATH $(MAKE) BUILD="shared" -C $(SASS_LIBSASS_PATH) else $(error SASS_LIBSASS_PATH must be defined) endif %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< test: all $(MAKE) -C $(SASS_LIBSASS_PATH) version libsass.res: $(WINDRES) res/libsass.rc -O coff libsass.res specs: all ifdef SASS_LIBSASS_PATH $(MAKE) -C $(SASS_LIBSASS_PATH) test_build else $(error SASS_LIBSASS_PATH must be defined) endif clean: rm -f $(OBJECTS) $(SASSC_EXE) \ bin/*.so bin/*.dll libsass.res ifdef SASS_LIBSASS_PATH $(MAKE) -C $(SASS_LIBSASS_PATH) clean endif .PHONY: test specs clean sassc \ all build-static build-shared \ libsass libsass-static libsass-shared .DELETE_ON_ERROR: sassc-3.4.5/Makefile.am000066400000000000000000000017151305706433200147020ustar00rootroot00000000000000ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 -I script AM_COPT = -Wall -O2 AM_COVLDFLAGS = if ENABLE_COVERAGE AM_COPT = -O0 --coverage AM_COVLDFLAGS += -lgcov endif AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = $(AM_COPT) AM_CXXFLAGS = $(AM_COPT) AM_LDFLAGS = $(AM_COPT) $(AM_COVLDFLAGS) # only needed to support old source tree # we have moved the files to src folder AM_CPPFLAGS += -I$(top_srcdir) SOURCES = sassc.c if COMPILER_IS_MINGW32 SOURCES += res/libsass.rc AM_CXXFLAGS += -std=gnu++0x AM_LDFLAGS += -std=gnu++0x else AM_CXXFLAGS += -std=c++0x AM_LDFLAGS += -std=c++0x endif if ENABLE_COVERAGE AM_CFLAGS += -O0 --coverage AM_CXXFLAGS += -O0 --coverage AM_LDFLAGS += -O0 --coverage -lgcov else AM_CFLAGS += -O2 AM_CXXFLAGS += -O2 endif bin_PROGRAMS = sassc sassc_SOURCES = $(SOURCES) sassc_LDFLAGS = $(AM_LDFLAGS) # Dummy C++ source to cause C++ linking. # Otherwise the plain C linker is used nodist_EXTRA_sassc_SOURCES = dummy.cxxsassc-3.4.5/Readme.md000066400000000000000000000036731305706433200143720ustar00rootroot00000000000000SassC ======= [![Unix CI](https://secure.travis-ci.org/sass/sassc.svg?branch=master)](http://travis-ci.org/sass/sassc) [![Windows CI](https://ci.appveyor.com/api/projects/status/github/sass/sassc?svg=true)](https://ci.appveyor.com/project/sass/sassc/branch/master) by Aaron Leung ([@akhleung]), Hampton Catlin ([@hcatlin]), Marcel Greter ([@mgreter]) and Michael Mifsud ([@xzyfer]) http://github.com/sass/sassc About SassC ----------- SassC is a wrapper around libsass (http://github.com/sass/libsass) used to generate a useful command-line application that can be installed and packaged for several operating systems. SassC currently statically links the libsass library, but might one day using dynamic linking if libsass supports that in the future. About Sass ---------- Sass is a CSS pre-processor language to add on exciting, new, awesome features to CSS. Sass was the first language of its kind and by far the most mature and up to date codebase. Sass was originally concieved of by the co-creator of this library, Hampton Catlin ([@hcatlin]). Most of the language has been the result of years of work by Natalie Weizenbaum ([@nex3]) and Chris Eppstein ([@chriseppstein]). For more information about Sass itself, please visit http://sass-lang.com Initial development of SassC by Aaron Leung and Hampton Catlin was supported by [Moovweb](http://www.moovweb.com). Documentation ------------- * [Building on Unix](docs/building/unix-instructions.md) * [Building on Windows](docs/building/windows-instructions.md) * [Testing on Unix](docs/testing/unix-instructions.md) * [Testing on Windows](docs/testing/windows-instructions.md) Licensing --------- Our MIT license is designed to be as simple, and liberal as possible. [@hcatlin]: https://github.com/hcatlin [@akhleung]: https://github.com/akhleung [@chriseppstein]: https://github.com/chriseppstein [@nex3]: https://github.com/nex3 [@mgreter]: https://github.com/mgreter [@xzyfer]: https://github.com/xzyfer sassc-3.4.5/appveyor.yml000066400000000000000000000021711305706433200152330ustar00rootroot00000000000000os: Visual Studio 2015 environment: LIBSASS_DIR: ..\libsass matrix: - configuration: Debug - configuration: Release cache: - C:\Ruby%ruby_version%\lib\ruby\gems install: - git clone https://github.com/sass/libsass.git - cd libsass - git clone https://github.com/sass/sass-spec - cd %APPVEYOR_BUILD_FOLDER% build: parallel: true project: win\sassc.sln after_build: - bin\sassc -v - call "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" - dumpbin /dependents bin\sassc.exe # equivalent of Unix' lld utility test_script: - gem install sass minitest - ruby libsass\sass-spec\sass-spec.rb -c bin\sassc -s libsass\sass-spec\spec test: off # Turn off the test script to speedup the CI builds, set it to on or remove the previous line when needed. artifacts: path: bin deploy: provider: GitHub description: $(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED) auth_token: secure: xGL+pDUi3VJOZWGREe3wEGuZaOVA/Mg2BEhjHYIaUoKQCBhY1V9B6xNtix4CB1+8 draft: true prerelease: false on: branch: master appveyor_repo_tag: true # deploy on tag push only configuration: Release sassc-3.4.5/bin/000077500000000000000000000000001305706433200134125ustar00rootroot00000000000000sassc-3.4.5/bin/.gitignore000066400000000000000000000000161305706433200153770ustar00rootroot00000000000000* !.gitignore sassc-3.4.5/configure.ac000066400000000000000000000067211305706433200151360ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.61]) AC_INIT([sassc], m4_esyscmd_s([./version.sh]), [support@moovweb.com]) AC_CONFIG_SRCDIR([sassc.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([sassc_version.h]) AC_CONFIG_AUX_DIR([script]) # These are flags passed to automake # Though they look like gcc flags! AM_INIT_AUTOMAKE([foreign parallel-tests -Wall]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([no])]) # the new prefered way # only need install path AC_ARG_WITH([libsass], [AS_HELP_STRING([--with-libsass], [libsass install location])], [LDFLAGS="$LDFLAGS -L$withval/lib"] [CPPFLAGS="$CPPFLAGS -I$withval/include"]) # this is discouraged, use `with-libsass`: AC_ARG_WITH([libsass-lib], [AS_HELP_STRING([--with-libsass-lib], [location of libsass library])], [AC_MSG_WARN([use of --with-libsass-lib is discouraged! use new syntax: ./configure --with-libsass="prefix"])] [LDFLAGS="$LDFLAGS -L$withval"]) # this is discouraged, use `with-libsass`: # ./configure INCLUDE_PATH="build/include" AC_ARG_WITH([libsass-include], [AS_HELP_STRING([--with-libsass-include], [location of libsass headers])], [AC_MSG_WARN([use of --with-libsass-include is discouraged, use new syntax: ./configure --with-libsass="prefix"])] [CPPFLAGS="$CPPFLAGS -I$withval"]) # Checks for programs. AC_PROG_CC AC_PROG_CXX AC_LANG([C++]) AC_GNU_SOURCE # Check fails on Travis, but it works fine # AX_CXX_COMPILE_STDCXX_11([ext],[optional]) AC_CHECK_TOOL([AR], [ar], [false]) AC_CHECK_TOOL([DLLTOOL], [dlltool], [false]) AC_CHECK_TOOL([DLLWRAP], [dllwrap], [false]) AC_CHECK_TOOL([WINDRES], [windres], [false]) m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AM_PROG_AR([]) LT_INIT([dlopen]) AS_CASE([$host], [*-*-mingw*], [is_mingw32=yes], [is_mingw32=no]) AM_CONDITIONAL(COMPILER_IS_MINGW32, test "x$is_mingw32" = "xyes") dnl The dlopen() function is in the C library for *BSD and in dnl libdl on GLIBC-based systems if test "x$is_mingw32" != "xyes"; then AC_SEARCH_LIBS([dlopen], [dl dld], [], [ AC_MSG_ERROR([unable to find the dlopen() function]) ]) fi # check the main assets needed to link to libsass (headers and library) AC_CHECK_LIB([sass],[libsass_version],, [AC_MSG_ERROR([unable to find libsass library (use --with-libsass?)])]) AC_CHECK_HEADERS([sass.h],, [AC_MSG_ERROR([unable to find libsass headers (use --with-libsass?)])]) # also check for additional libsass headers (just in case) AC_CHECK_HEADERS([sass2scss.h],, [AC_MSG_ERROR([unable to find sass2scss.h])]) AC_CHECK_HEADERS([sass/values.h],, [AC_MSG_ERROR([unable to find sass/values.h])]) AC_CHECK_HEADERS([sass/functions.h],, [AC_MSG_ERROR([unable to find sass_functions.h])]) AC_CHECK_HEADERS([sass/context.h],, [AC_MSG_ERROR([unable to find sass/context.h])]) AC_ARG_ENABLE([coverage], [AS_HELP_STRING([--enable-coverage], [enable coverage report for test suite])], [enable_cov=$enableval], [enable_cov=no]) if test "x$enable_cov" = "xyes"; then AC_CHECK_PROG(GCOV, gcov, gcov) # Remove all optimization flags from C[XX]FLAGS changequote({,}) CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9]*//g'` changequote([,]) AC_SUBST(GCOV) fi AC_CHECK_PROG(WINDRES, windres, windres) AM_CONDITIONAL(ENABLE_COVERAGE, test "x$enable_cov" = "xyes") AC_MSG_NOTICE([Building sassc ($VERSION)]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT sassc-3.4.5/docs/000077500000000000000000000000001305706433200135725ustar00rootroot00000000000000sassc-3.4.5/docs/building/000077500000000000000000000000001305706433200153675ustar00rootroot00000000000000sassc-3.4.5/docs/building/unix-instructions.md000066400000000000000000000016501305706433200214400ustar00rootroot00000000000000# Building On Unix To build SassC, you must have either local copy of the LibSass source or it must be installed into your system. For development, please use the source version. The executable will be in the bin folder. To run it, simply try something like ```bash ./bin/sassc [input file] > output.css ``` # Step-by-step 1. Clone the SassC repo ```bash git clone https://github.com/sass/sassc.git ``` 1. cd into the SassC repo ```bash cd ./sassc ``` 1. Type 'script/bootstrap' to clone [`libsass`](https://github.com/sass/libsass) and [`sass-spec`](https://github.com/sass/sass-spec) into the parent directory ```bash script/bootstrap ``` Alternately, if you already have libsass cloned or installed, you can edit your `.bash_profile` to include libsass directory: ```bash export SASS_LIBSASS_PATH=/Users/you/path/libsass ``` 1. Type 'make' ```bash make ``` 1. Job done! sassc-3.4.5/docs/building/windows-instructions.md000066400000000000000000000075651305706433200221620ustar00rootroot00000000000000# Building On Windows To build SassC, the following pre-requisites must be met: * Local copy of the LibSass source. * Visual Studio 2013 Express for Desktop or higher. Additionally, it is recommended to have `git` installed and available in `PATH`, so to deduce the `libsass` and `sassc` version information. For instance, if GitHub for Windows (https://windows.github.com/) is installed, the `PATH` will have an entry resembling: `X:\Users\\AppData\Local\GitHub\PortableGit_\cmd\` (where `X` is the drive letter of system drive). If `git` is not available, inquiring the LibSass and SassC versions will result in `[NA]`. > Note that with `Debug` or `Release` we statically compile VC runtime libraries (e.g. `MSVCP140.dll`) in sassc.exe which result in self-dependent / portable binary that is comparatively large in size. There are separate build configurations for shared runtime: `Debug without static runtime` and `Release without static runtime`, which produce the binary dependent on [VS2015 Redistributable package](https://www.microsoft.com/en-gb/download/details.aspx?id=48145) on the target system. If your target system (where you want to execute sassc.exe) already has VCR (via redistributable pack or Visual Studio itself), it is highly recommended to use this shared configuration. This way when the shared runtime libs receive an updated (performance improvements or bug fixes), the statically compiled image will not be able to take advantage of such updates. ## Obtaining the Sources: If `git` in available in `PATH`, open `cmd` or `PowerShell` and run: ```cmd :: clone LibSass repository: cd projects git clone https://github.com/sass/libsass :: clone SassC repository inside `libsass\`: cd libsass git clone https://github.com/sass/sassc ``` Otherwise download LibSass and SassC sources from github, unzip and arrange so the structure looks like: `libsass\sassc`. If you want LibSass repo directory to be placed somewhere else, then set the environment variable `LIBSASS_DIR` with relative path based at the location of `sassc.sln`. ## From Visual Studio: Open `projects\libsass\sassc\win\sassc.sln`, and do the finger dance `Ctrl+Shift+B` to build `sassc.exe`. Visual Studio will form the filtered source tree as shown below: ![image](https://cloud.githubusercontent.com/assets/3840695/9313507/f4da01f0-452b-11e5-9276-bed0acc06263.png) `Header Files` contains the `.h` and `.hpp` files, while `Source Files` covers `.c` and `.cpp` of SassC. `LibSass\Header Files` and `LibSass\Source Files` contain headers and source of LibSass. The other used headers/sources will appear under `External Dependencies`. The executable will be in the bin folder under sassc (`sassc\bin\sassc.exe`). ## From Command Line Interface: Notice that in the following commands: * If the platform is 32-bit Windows, replace `ProgramFiles(x86)` with `ProgramFiles`. * To build with Visual Studio 2015, replace `12.0` with `14.0` in the aforementioned command. * To build 32-bit binary, add `/p:Platform=Win32`. * To build 64-bit binary, add `/p:platform=Win64`. For example, in `cmd`, run: ```cmd cd projects\libsass\sassc :: 32-bit debug build with statically compiled runtime libs: "%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\sassc.sln ^ /p:Configuration=Debug /p:Platform=Win32 ``` In `PowerShell`, the above variant would be: ```powershell cd projects\libsass\sassc # 64-bit release build without statically compiled runtime libs: &"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\sassc.sln ` /p:Configuration='Release without static runtime' /p:Platform=Win64 ``` You can also override the `LIBSASS_DIR` path by augmenting msbuild properties, such as: `/p:LIBSASS_DIR=../../some/path/leading/to/libsass;Configuration=Release`. The executable will be in the bin folder under sassc (`sassc\bin\sassc.exe`). To run it, simply try something like ```cmd sassc\bin\sassc [input file] > output.css ``` sassc-3.4.5/docs/testing/000077500000000000000000000000001305706433200152475ustar00rootroot00000000000000sassc-3.4.5/docs/testing/unix-instructions.md000066400000000000000000000014131305706433200213150ustar00rootroot00000000000000# Testing on Unix The official libsass/sassc test suite is located at http://github.com/sass/sass-spec. It's a specialized project just to ensure that Sass works as expected. First, go clone (and ensure its up-to-date) the sass-spec repo. THEN, you must setup an environment variable to point to the spec folder. Also, if you want to test against the latest libsass, you MUST define the location of a copy of the libsass repo. For instance, this is in my profile. ```bash export SASS_SPEC_PATH=/Users/you/dev/sass/sass-spec export SASS_SASSC_PATH=/Users/you/dev/sass/sassc export SASS_LIBSASS_PATH=/Users/you/dev/sass/libsass ``` Then, run the SassC specific tests this way: ```bash make test ``` Or, if you want to run the whole SassSpec suite ```bash make test_spec ``` sassc-3.4.5/docs/testing/windows-instructions.md000066400000000000000000000015251305706433200220300ustar00rootroot00000000000000# Testing on Windows The official libsass/sassc test suite is located at http://github.com/sass/sass-spec. It's a specialized project just to ensure that Sass works as expected. To run the libsass tests, Ruby should be installed in your system. Download https://www.ruby-lang.org/en/downloads/. After [building SassC](../building/windows-instructions.md), run the SassC specific tests this way: ```cmd :: `ruby` should be available in PATH :: install a required ruby gem for testing: gem install minitest :: enter the libsass directory cd libsass :: clone sass-spec repo git clone https://github.com/sass/sass-spec :: run entire test suite ruby sass-spec/sass-spec.rb -c sassc/bin/sassc -s sass-spec/spec ``` If you want to skip the tests for known bugs: ```cmd ruby sass-spec/sass-spec.rb -c sassc/bin/sassc -s --ignore-todo sass-spec/spec ``` sassc-3.4.5/m4/000077500000000000000000000000001305706433200131625ustar00rootroot00000000000000sassc-3.4.5/m4/.gitkeep000066400000000000000000000000001305706433200146010ustar00rootroot00000000000000sassc-3.4.5/res/000077500000000000000000000000001305706433200134335ustar00rootroot00000000000000sassc-3.4.5/res/libsass.ico000066400000000000000000000015761305706433200156000ustar00rootroot00000000000000h(  <;;<;;<;;<;;<;;;;;<;;<;;<;;<;;<;;<;;<;;<;;>==A@@A@@A@@A@@B>A@@A@@A@@A@@A@@A@@;::<;;A@@A@@A@@B<>SpWϒV{GEF@>>A@@A@@A@@A@@A@@<;;<;;A@@@=>A5:F6=UΑWzVV{B:=A@@A@@A@@A@@A@@<;;<;;?8;NZSUUpUjYRZV\GIH@>>A@@A@@A@@A@@<;;;89L^UaWUsD8>Pj]a]˓JMK@=>A@@A@@A@@A@@<;;;47RjUғH5>@7;A7;Pi\\Ï[}Vqc?;=A@@A@@A@@A@@<;;;47QhU͐E?B@8@8<@8;@=>A@@A@@<;;;47QhU͐D9>MaWVOcX>27KUPXqXwSjJPLA97:XseSscQsaX|ZϔR{fA9<<;;;47RjVՕE=AGEFTΑTH?C>59?9;?8;A5:OfZY֖Oh[;68;89McXVqC@A?9-5ToV=59<;;A=>A8OfZTWՕWٗXחWKVP;89>==A@@A@@A@@A@@A@@A@@@???:==<;;<;;<;;<;;<;;<;;<;;<;;<;;;::;89;89;;;<;;sassc-3.4.5/res/libsass.rc000066400000000000000000000000271305706433200154200ustar00rootroot00000000000000icon ICON "libsass.ico"sassc-3.4.5/sassc.c000066400000000000000000000253771305706433200141400ustar00rootroot00000000000000#ifdef _MSC_VER #ifndef _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS 1 #endif #ifndef _CRT_NONSTDC_NO_WARNINGS #define _CRT_NONSTDC_NO_WARNINGS 1 #endif #endif #include #include #include #include #include #include "sassc_version.h" #define BUFSIZE 512 #ifdef _WIN32 #define PATH_SEP ';' #else #define PATH_SEP ':' #endif #ifdef _WIN32 #include #include #include #define isatty(h) _isatty(h) #define fileno(m) _fileno(m) int get_argv_utf8(int* argc_ptr, char*** argv_ptr) { int argc; char** argv; wchar_t** argv_utf16 = CommandLineToArgvW(GetCommandLineW(), &argc); int i; int offset = (argc + 1) * sizeof(char*); int size = offset; for (i = 0; i < argc; i++) size += WideCharToMultiByte(CP_UTF8, 0, argv_utf16[i], -1, 0, 0, 0, 0); argv = malloc(size); for (i = 0; i < argc; i++) { argv[i] = (char*) argv + offset; offset += WideCharToMultiByte(CP_UTF8, 0, argv_utf16[i], -1, argv[i], size-offset, 0, 0); } *argc_ptr = argc; *argv_ptr = argv; return 0; } #else #include #endif int output(int error_status, const char* error_message, const char* output_string, const char* outfile) { if (error_status) { if (error_message) { fprintf(stderr, "%s", error_message); } else { fprintf(stderr, "An error occured; no error message available.\n"); } return 1; } else if (output_string) { if(outfile) { FILE* fp = fopen(outfile, "wb"); if(!fp) { perror("Error opening output file"); return 1; } if(fprintf(fp, "%s", output_string) < 0) { perror("Error writing to output file"); fclose(fp); return 1; } fclose(fp); } else { #ifdef _WIN32 setmode(fileno(stdout), O_BINARY); #endif printf("%s", output_string); } return 0; } else { fprintf(stderr, "Unknown internal error.\n"); return 2; } } int compile_stdin(struct Sass_Options* options, char* outfile) { int ret; struct Sass_Data_Context* ctx; char buffer[BUFSIZE]; size_t size = 1; char *source_string = malloc(sizeof(char) * BUFSIZE); if(source_string == NULL) { perror("Allocation failed"); exit(1); } source_string[0] = '\0'; while(fgets(buffer, BUFSIZE, stdin)) { char *old = source_string; size += strlen(buffer); source_string = realloc(source_string, size); if(source_string == NULL) { perror("Reallocation failed"); free(old); exit(2); } strcat(source_string, buffer); } if(ferror(stdin)) { free(source_string); perror("Error reading standard input"); exit(2); } ctx = sass_make_data_context(source_string); struct Sass_Context* ctx_out = sass_data_context_get_context(ctx); sass_data_context_set_options(ctx, options); sass_compile_data_context(ctx); ret = output( sass_context_get_error_status(ctx_out), sass_context_get_error_message(ctx_out), sass_context_get_output_string(ctx_out), outfile ); sass_delete_data_context(ctx); return ret; } int compile_file(struct Sass_Options* options, char* input_path, char* outfile) { int ret; struct Sass_File_Context* ctx = sass_make_file_context(input_path); struct Sass_Context* ctx_out = sass_file_context_get_context(ctx); if (outfile) sass_option_set_output_path(options, outfile); const char* srcmap_file = sass_option_get_source_map_file(options); sass_option_set_input_path(options, input_path); sass_file_context_set_options(ctx, options); sass_compile_file_context(ctx); ret = output( sass_context_get_error_status(ctx_out), sass_context_get_error_message(ctx_out), sass_context_get_output_string(ctx_out), outfile ); if (ret == 0 && srcmap_file) { ret = output( sass_context_get_error_status(ctx_out), sass_context_get_error_message(ctx_out), sass_context_get_source_map_string(ctx_out), srcmap_file ); } sass_delete_file_context(ctx); return ret; } struct { char* style_string; int output_style; } style_option_strings[] = { { "compressed", SASS_STYLE_COMPRESSED }, { "compact", SASS_STYLE_COMPACT }, { "expanded", SASS_STYLE_EXPANDED }, { "nested", SASS_STYLE_NESTED } }; #define NUM_STYLE_OPTION_STRINGS \ sizeof(style_option_strings) / sizeof(style_option_strings[0]) void print_version() { printf("sassc: %s\n", SASSC_VERSION); printf("libsass: %s\n", libsass_version()); printf("sass2scss: %s\n", sass2scss_version()); printf("sass: %s\n", libsass_language_version()); } void print_usage(char* argv0) { int i; printf("Usage: %s [options] [INPUT] [OUTPUT]\n\n", argv0); printf("Options:\n"); printf(" -s, --stdin Read input from standard input instead of an input file.\n"); printf(" -t, --style NAME Output style. Can be:"); for(i = NUM_STYLE_OPTION_STRINGS - 1; i >= 0; i--) { printf(" %s", style_option_strings[i].style_string); printf(i == 0 ? ".\n" : ","); } printf(" -l, --line-numbers Emit comments showing original line numbers.\n"); printf(" --line-comments\n"); printf(" -I, --load-path PATH Set Sass import path.\n"); printf(" -P, --plugin-path PATH Set path to autoload plugins.\n"); printf(" -m, --sourcemap Emit source map.\n"); printf(" -M, --omit-map-comment Omits the source map url comment.\n"); printf(" -p, --precision Set the precision for numbers.\n"); printf(" -a, --sass Treat input as indented syntax.\n"); printf(" -v, --version Display compiled versions.\n"); printf(" -h, --help Display this help message.\n"); printf("\n"); } void invalid_usage(char* argv0) { fprintf(stderr, "See '%s -h'\n", argv0); exit(EXIT_FAILURE); } int main(int argc, char** argv) { #ifdef _MSC_VER _set_error_mode(_OUT_TO_STDERR); _set_abort_behavior( 0, _WRITE_ABORT_MSG); #endif #ifdef _WIN32 get_argv_utf8(&argc, &argv); #endif if ((argc == 1) && isatty(fileno(stdin))) { print_usage(argv[0]); return 0; } char *outfile = 0; int from_stdin = 0; bool generate_source_map = false; struct Sass_Options* options = sass_make_options(); sass_option_set_output_style(options, SASS_STYLE_NESTED); sass_option_set_precision(options, 5); int c; size_t i; int long_index = 0; static struct option long_options[] = { { "stdin", no_argument, 0, 's' }, { "load-path", required_argument, 0, 'I' }, { "plugin-path", required_argument, 0, 'P' }, { "style", required_argument, 0, 't' }, { "line-numbers", no_argument, 0, 'l' }, { "line-comments", no_argument, 0, 'l' }, { "sourcemap", no_argument, 0, 'm' }, { "omit-map-comment", no_argument, 0, 'M' }, { "precision", required_argument, 0, 'p' }, { "version", no_argument, 0, 'v' }, { "sass", no_argument, 0, 'a' }, { "help", no_argument, 0, 'h' }, { NULL, 0, NULL, 0} }; while ((c = getopt_long(argc, argv, "vhslmMap:t:I:P:", long_options, &long_index)) != -1) { switch (c) { case 's': from_stdin = 1; break; case 'I': sass_option_push_include_path(options, optarg); break; case 'P': sass_option_push_plugin_path(options, optarg); break; case 't': for(i = 0; i < NUM_STYLE_OPTION_STRINGS; ++i) { if(strcmp(optarg, style_option_strings[i].style_string) == 0) { sass_option_set_output_style(options, style_option_strings[i].output_style); break; } } if(i == NUM_STYLE_OPTION_STRINGS) { fprintf(stderr, "Invalid argument for -t flag: '%s'. Allowed arguments are:", optarg); for(i = 0; i < NUM_STYLE_OPTION_STRINGS; ++i) { fprintf(stderr, " %s", style_option_strings[i].style_string); } fprintf(stderr, "\n"); invalid_usage(argv[0]); } break; case 'l': sass_option_set_source_comments(options, true); break; case 'm': generate_source_map = true; break; case 'M': sass_option_set_omit_source_map_url(options, true); break; case 'p': sass_option_set_precision(options, atoi(optarg)); // TODO: make this more robust if (sass_option_get_precision(options) < 0) sass_option_set_precision(options, 5); break; case 'a': sass_option_set_is_indented_syntax_src(options, true); break; case 'v': print_version(); sass_delete_options(options); return 0; case 'h': print_usage(argv[0]); sass_delete_options(options); return 0; case '?': /* Unrecognized flag or missing an expected value */ /* getopt should produce it's own error message for this case */ invalid_usage(argv[0]); default: fprintf(stderr, "Unknown error while processing arguments\n"); sass_delete_options(options); return 2; } } if(optind < argc - 2) { fprintf(stderr, "Error: Too many arguments.\n"); invalid_usage(argv[0]); } int result; const char* dash = "-"; if(optind < argc && strcmp(argv[optind], dash) != 0 && !from_stdin) { if (optind + 1 < argc) { outfile = argv[optind + 1]; } if (generate_source_map && outfile) { const char* extension = ".map"; char* source_map_file = calloc(strlen(outfile) + strlen(extension) + 1, sizeof(char)); strcpy(source_map_file, outfile); strcat(source_map_file, extension); sass_option_set_source_map_file(options, source_map_file); } result = compile_file(options, argv[optind], outfile); } else { if (optind < argc) { outfile = argv[optind]; } result = compile_stdin(options, outfile); } sass_delete_options(options); return result; } sassc-3.4.5/sassc_version.h000066400000000000000000000001631305706433200156740ustar00rootroot00000000000000#ifndef SASSC_VERSION_H #define SASSC_VERSION_H #ifndef SASSC_VERSION #define SASSC_VERSION "[NA]" #endif #endif sassc-3.4.5/sassc_version.h.in000066400000000000000000000002001305706433200162710ustar00rootroot00000000000000#ifndef SASSC_VERSION_H #define SASSC_VERSION_H #ifndef SASSC_VERSION #define SASSC_VERSION "@PACKAGE_VERSION@" #endif #endif sassc-3.4.5/script/000077500000000000000000000000001305706433200141465ustar00rootroot00000000000000sassc-3.4.5/script/bootstrap000077500000000000000000000015331305706433200161130ustar00rootroot00000000000000#!/bin/bash set -e SCRIPTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )" if [ "x$SASS_LIBSASS_PATH" == "x" ]; then export SASS_LIBSASS_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../libsass/ && pwd )" echo "SASS_LIBSASS_PATH variable is missing missing, so using $SASS_LIBSASS_PATH" fi if [ ! -d "$SASS_LIBSASS_PATH" ]; then git clone https://github.com/sass/libsass.git "$SASS_LIBSASS_PATH" else echo "LibSass already exists, skiping Git Clone" fi if [ "x$SASS_SPEC_PATH" == "x" ]; then export SASS_SPEC_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../sass-spec/ && pwd )" echo "SASS_SPEC_PATH variable is missing, so using $SASS_SPEC_PATH" fi if [ ! -d "$SASS_SPEC_PATH" ]; then git clone https://github.com/sass/sass-spec.git "$SASS_SPEC_PATH" else echo "sass-spec already exists, skiping Git Clone" fi sassc-3.4.5/script/ci-build-libsass000077500000000000000000000041221305706433200172210ustar00rootroot00000000000000#!/bin/bash set -e # script/bootstrap # export this path right here (was in script/spec before) export SASS_SASSC_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../ && pwd )" # use some defaults if not running under travis ci if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then export TRAVIS_BUILD_DIR=$(pwd)/build; fi if [ "x$SASS_LIBSASS_PATH" == "x" ]; then export SASS_LIBSASS_PATH=$(pwd)/..; fi if [ "x$SASS_SPEC_PATH" == "x" ]; then export SASS_SPEC_PATH=$(pwd)/sass-spec; fi if [ "x$COVERAGE" == "xyes" ]; then COVERAGE_OPT="--enable-coverage" export EXTRA_CFLAGS="--coverage" export EXTRA_CXXFLAGS="--coverage" export EXTRA_LDFLAGS="--coverage" else COVERAGE_OPT="--disable-coverage" fi if [ "x$BUILD" == "xstatic" ]; then SHARED_OPT="--disable-shared --enable-static" MAKE_TARGET="static" else # Makefile of sassc wants to link to static SHARED_OPT="--enable-shared --enable-static" MAKE_TARGET="shared" fi if [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then MAKE_OPTS="$MAKE_OPTS -j1 V=1" else MAKE_OPTS="$MAKE_OPTS -j5 V=1" fi if [ "x$PREFIX" == "x" ]; then if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then PREFIX=$SASS_LIBSASS_PATH/build else PREFIX=$TRAVIS_BUILD_DIR fi fi if [ "x$AUTOTOOLS" == "xyes" ]; then pushd $SASS_LIBSASS_PATH echo -en 'travis_fold:start:libsass\r' autoreconf --force --install ./configure --disable-tests $COVERAGE_OPT \ --disable-silent-rules \ --prefix=$PREFIX \ ${SHARED_OPT} # always rebuild make $MAKE_OPTS clean # install the library make $MAKE_OPTS install echo -en 'travis_fold:end:libsass\r' popd echo -en 'travis_fold:start:configure\r' autoreconf --force --install ./configure \ --with-libsass="$PREFIX" \ --disable-silent-rules \ --prefix=$PREFIX \ $COVERAGE_OPT \ ${SHARED_OPT} echo -en 'travis_fold:end:configure\r' fi # always rebuild make $MAKE_OPTS clean # does what $BUILD says make $MAKE_OPTS all make $MAKE_OPTS install echo successfully compiled sassc echo AUTOTOOLS=$AUTOTOOLS COVERAGE=$COVERAGE BUILD=$BUILD LD_LIBRARY_PATH="$PREFIX/lib" $PREFIX/bin/sassc -v sassc-3.4.5/version.sh000077500000000000000000000004361305706433200146710ustar00rootroot00000000000000if test "x$SASSC_VERSION" = "x"; then SASSC_VERSION=`git describe --abbrev=4 --dirty --always --tags 2>/dev/null` fi if test "x$SASSC_VERSION" = "x"; then SASSC_VERSION=`cat VERSION 2>/dev/null` fi if test "x$SASSC_VERSION" = "x"; then SASSC_VERSION="[na]" fi echo $SASSC_VERSION sassc-3.4.5/win/000077500000000000000000000000001305706433200134375ustar00rootroot00000000000000sassc-3.4.5/win/posix/000077500000000000000000000000001305706433200146015ustar00rootroot00000000000000sassc-3.4.5/win/posix/getopt.c000066400000000000000000000365751305706433200162670ustar00rootroot00000000000000/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* * Copyright (c) 2002 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Sponsored in part by the Defense Advanced Research Projects * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Dieter Baron and Thomas Klausner. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include #include #include #define REPLACE_GETOPT /* use this getopt as the system getopt(3) */ #ifdef REPLACE_GETOPT int opterr = 1; /* if error message should be printed */ int optind = 1; /* index into parent argv vector */ int optopt = '?'; /* character checked for validity */ #undef optreset /* see getopt.h */ #define optreset __mingw_optreset int optreset; /* reset getopt */ char *optarg; /* argument associated with option */ #endif #define PRINT_ERROR ((opterr) && (*options != ':')) #define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */ #define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */ #define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */ /* return values */ #define BADCH (int)'?' #define BADARG ((*options == ':') ? (int)':' : (int)'?') #define INORDER (int)1 #ifndef __CYGWIN__ #define __progname __argv[0] #else extern char __declspec(dllimport) *__progname; #endif #ifdef __CYGWIN__ static char EMSG[] = ""; #else #define EMSG "" #endif static int getopt_internal(int, char * const *, const char *, const struct option *, int *, int); static int parse_long_options(char * const *, const char *, const struct option *, int *, int); static int gcd(int, int); static void permute_args(int, int, int, char * const *); static char *place = EMSG; /* option letter processing */ /* XXX: set optreset to 1 rather than these two */ static int nonopt_start = -1; /* first non option argument (for permute) */ static int nonopt_end = -1; /* first option after non options (for permute) */ /* Error messages */ static const char recargchar[] = "option requires an argument -- %c"; static const char recargstring[] = "option requires an argument -- %s"; static const char ambig[] = "ambiguous option -- %.*s"; static const char noarg[] = "option doesn't take an argument -- %.*s"; static const char illoptchar[] = "unknown option -- %c"; static const char illoptstring[] = "unknown option -- %s"; static void _vwarnx(const char *fmt,va_list ap) { (void)fprintf(stderr,"%s: ",__progname); if (fmt != NULL) (void)vfprintf(stderr,fmt,ap); (void)fprintf(stderr,"\n"); } static void warnx(const char *fmt,...) { va_list ap; va_start(ap,fmt); _vwarnx(fmt,ap); va_end(ap); } /* * Compute the greatest common divisor of a and b. */ static int gcd(int a, int b) { int c; c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return (b); } /* * Exchange the block from nonopt_start to nonopt_end with the block * from nonopt_end to opt_end (keeping the same order of arguments * in each block). */ static void permute_args(int panonopt_start, int panonopt_end, int opt_end, char * const *nargv) { int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos; char *swap; /* * compute lengths of blocks and number and size of cycles */ nnonopts = panonopt_end - panonopt_start; nopts = opt_end - panonopt_end; ncycle = gcd(nnonopts, nopts); cyclelen = (opt_end - panonopt_start) / ncycle; for (i = 0; i < ncycle; i++) { cstart = panonopt_end+i; pos = cstart; for (j = 0; j < cyclelen; j++) { if (pos >= panonopt_end) pos -= nnonopts; else pos += nopts; swap = nargv[pos]; /* LINTED const cast */ ((char **) nargv)[pos] = nargv[cstart]; /* LINTED const cast */ ((char **)nargv)[cstart] = swap; } } } /* * parse_long_options -- * Parse long options in argc/argv argument vector. * Returns -1 if short_too is set and the option does not match long_options. */ static int parse_long_options(char * const *nargv, const char *options, const struct option *long_options, int *idx, int short_too) { char *current_argv, *has_equal; size_t current_argv_len; int i, ambiguous, match; #define IDENTICAL_INTERPRETATION(_x, _y) \ (long_options[(_x)].has_arg == long_options[(_y)].has_arg && \ long_options[(_x)].flag == long_options[(_y)].flag && \ long_options[(_x)].val == long_options[(_y)].val) current_argv = place; match = -1; ambiguous = 0; optind++; if ((has_equal = strchr(current_argv, '=')) != NULL) { /* argument found (--option=arg) */ current_argv_len = has_equal - current_argv; has_equal++; } else current_argv_len = strlen(current_argv); for (i = 0; long_options[i].name; i++) { /* find matching long option */ if (strncmp(current_argv, long_options[i].name, current_argv_len)) continue; if (strlen(long_options[i].name) == current_argv_len) { /* exact match */ match = i; ambiguous = 0; break; } /* * If this is a known short option, don't allow * a partial match of a single character. */ if (short_too && current_argv_len == 1) continue; if (match == -1) /* partial match */ match = i; else if (!IDENTICAL_INTERPRETATION(i, match)) ambiguous = 1; } if (ambiguous) { /* ambiguous abbreviation */ if (PRINT_ERROR) warnx(ambig, (int)current_argv_len, current_argv); optopt = 0; return (BADCH); } if (match != -1) { /* option found */ if (long_options[match].has_arg == no_argument && has_equal) { if (PRINT_ERROR) warnx(noarg, (int)current_argv_len, current_argv); /* * XXX: GNU sets optopt to val regardless of flag */ if (long_options[match].flag == NULL) optopt = long_options[match].val; else optopt = 0; return (BADARG); } if (long_options[match].has_arg == required_argument || long_options[match].has_arg == optional_argument) { if (has_equal) optarg = has_equal; else if (long_options[match].has_arg == required_argument) { /* * optional argument doesn't use next nargv */ optarg = nargv[optind++]; } } if ((long_options[match].has_arg == required_argument) && (optarg == NULL)) { /* * Missing argument; leading ':' indicates no error * should be generated. */ if (PRINT_ERROR) warnx(recargstring, current_argv); /* * XXX: GNU sets optopt to val regardless of flag */ if (long_options[match].flag == NULL) optopt = long_options[match].val; else optopt = 0; --optind; return (BADARG); } } else { /* unknown option */ if (short_too) { --optind; return (-1); } if (PRINT_ERROR) warnx(illoptstring, current_argv); optopt = 0; return (BADCH); } if (idx) *idx = match; if (long_options[match].flag) { *long_options[match].flag = long_options[match].val; return (0); } else return (long_options[match].val); #undef IDENTICAL_INTERPRETATION } /* * getopt_internal -- * Parse argc/argv argument vector. Called by user level routines. */ static int getopt_internal(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx, int flags) { char *oli; /* option letter list index */ int optchar, short_too; static int posixly_correct = -1; if (options == NULL) return (-1); /* * XXX Some GNU programs (like cvs) set optind to 0 instead of * XXX using optreset. Work around this braindamage. */ if (optind == 0) optind = optreset = 1; /* * Disable GNU extensions if POSIXLY_CORRECT is set or options * string begins with a '+'. * * CV, 2009-12-14: Check POSIXLY_CORRECT anew if optind == 0 or * optreset != 0 for GNU compatibility. */ if (posixly_correct == -1 || optreset != 0) { #ifdef _MSC_VER size_t requiredSize; getenv_s(&requiredSize, NULL, 0, "POSIXLY_CORRECT"); posixly_correct = requiredSize > 0; #else posixly_correct = (getenv("POSIXLY_CORRECT") != NULL); #endif } if (*options == '-') flags |= FLAG_ALLARGS; else if (posixly_correct || *options == '+') flags &= ~FLAG_PERMUTE; if (*options == '+' || *options == '-') options++; optarg = NULL; if (optreset) nonopt_start = nonopt_end = -1; start: if (optreset || !*place) { /* update scanning pointer */ optreset = 0; if (optind >= nargc) { /* end of argument vector */ place = EMSG; if (nonopt_end != -1) { /* do permutation, if we have to */ permute_args(nonopt_start, nonopt_end, optind, nargv); optind -= nonopt_end - nonopt_start; } else if (nonopt_start != -1) { /* * If we skipped non-options, set optind * to the first of them. */ optind = nonopt_start; } nonopt_start = nonopt_end = -1; return (-1); } if (*(place = nargv[optind]) != '-' || (place[1] == '\0' && strchr(options, '-') == NULL)) { place = EMSG; /* found non-option */ if (flags & FLAG_ALLARGS) { /* * GNU extension: * return non-option as argument to option 1 */ optarg = nargv[optind++]; return (INORDER); } if (!(flags & FLAG_PERMUTE)) { /* * If no permutation wanted, stop parsing * at first non-option. */ return (-1); } /* do permutation */ if (nonopt_start == -1) nonopt_start = optind; else if (nonopt_end != -1) { permute_args(nonopt_start, nonopt_end, optind, nargv); nonopt_start = optind - (nonopt_end - nonopt_start); nonopt_end = -1; } optind++; /* process next argument */ goto start; } if (nonopt_start != -1 && nonopt_end == -1) nonopt_end = optind; /* * If we have "-" do nothing, if "--" we are done. */ if (place[1] != '\0' && *++place == '-' && place[1] == '\0') { optind++; place = EMSG; /* * We found an option (--), so if we skipped * non-options, we have to permute. */ if (nonopt_end != -1) { permute_args(nonopt_start, nonopt_end, optind, nargv); optind -= nonopt_end - nonopt_start; } nonopt_start = nonopt_end = -1; return (-1); } } /* * Check long options if: * 1) we were passed some * 2) the arg is not just "-" * 3) either the arg starts with -- we are getopt_long_only() */ if (long_options != NULL && place != nargv[optind] && (*place == '-' || (flags & FLAG_LONGONLY))) { short_too = 0; if (*place == '-') place++; /* --foo long option */ else if (*place != ':' && strchr(options, *place) != NULL) short_too = 1; /* could be short option too */ optchar = parse_long_options(nargv, options, long_options, idx, short_too); if (optchar != -1) { place = EMSG; return (optchar); } } if ((optchar = (int)*place++) == (int)':' || (optchar == (int)'-' && *place != '\0') || (oli = strchr(options, optchar)) == NULL) { /* * If the user specified "-" and '-' isn't listed in * options, return -1 (non-option) as per POSIX. * Otherwise, it is an unknown option character (or ':'). */ if (optchar == (int)'-' && *place == '\0') return (-1); if (!*place) ++optind; if (PRINT_ERROR) warnx(illoptchar, optchar); optopt = optchar; return (BADCH); } if (long_options != NULL && optchar == 'W' && oli[1] == ';') { /* -W long-option */ if (*place) /* no space */ /* NOTHING */; else if (++optind >= nargc) { /* no arg */ place = EMSG; if (PRINT_ERROR) warnx(recargchar, optchar); optopt = optchar; return (BADARG); } else /* white space */ place = nargv[optind]; optchar = parse_long_options(nargv, options, long_options, idx, 0); place = EMSG; return (optchar); } if (*++oli != ':') { /* doesn't take argument */ if (!*place) ++optind; } else { /* takes (optional) argument */ optarg = NULL; if (*place) /* no white space */ optarg = place; else if (oli[1] != ':') { /* arg not optional */ if (++optind >= nargc) { /* no arg */ place = EMSG; if (PRINT_ERROR) warnx(recargchar, optchar); optopt = optchar; return (BADARG); } else optarg = nargv[optind]; } place = EMSG; ++optind; } /* dump back option letter */ return (optchar); } #ifdef REPLACE_GETOPT /* * getopt -- * Parse argc/argv argument vector. * * [eventually this will replace the BSD getopt] */ int getopt(int nargc, char * const *nargv, const char *options) { /* * We don't pass FLAG_PERMUTE to getopt_internal() since * the BSD getopt(3) (unlike GNU) has never done this. * * Furthermore, since many privileged programs call getopt() * before dropping privileges it makes sense to keep things * as simple (and bug-free) as possible. */ return (getopt_internal(nargc, nargv, options, NULL, NULL, 0)); } #endif /* REPLACE_GETOPT */ /* * getopt_long -- * Parse argc/argv argument vector. */ int getopt_long(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx) { return (getopt_internal(nargc, nargv, options, long_options, idx, FLAG_PERMUTE)); } /* * getopt_long_only -- * Parse argc/argv argument vector. */ int getopt_long_only(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx) { return (getopt_internal(nargc, nargv, options, long_options, idx, FLAG_PERMUTE|FLAG_LONGONLY)); } sassc-3.4.5/win/posix/getopt.h000066400000000000000000000060061305706433200162560ustar00rootroot00000000000000#ifndef __GETOPT_H__ /** * DISCLAIMER * This file has no copyright assigned and is placed in the Public Domain. * This file is a part of the w64 mingw-runtime package. * * The w64 mingw-runtime package and its code is distributed in the hope that it * will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR * IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #define __GETOPT_H__ /* All the headers include this file. */ #include #ifdef __cplusplus extern "C" { #endif extern int optind; /* index of first non-option in argv */ extern int optopt; /* single option character, as parsed */ extern int opterr; /* flag to enable built-in diagnostics... */ /* (user may set to zero, to suppress) */ extern char *optarg; /* pointer to argument of current option */ extern int getopt(int nargc, char * const *nargv, const char *options); #ifdef _BSD_SOURCE /* * BSD adds the non-standard `optreset' feature, for reinitialisation * of `getopt' parsing. We support this feature, for applications which * proclaim their BSD heritage, before including this header; however, * to maintain portability, developers are advised to avoid it. */ # define optreset __mingw_optreset extern int optreset; #endif #ifdef __cplusplus } #endif /* * POSIX requires the `getopt' API to be specified in `unistd.h'; * thus, `unistd.h' includes this header. However, we do not want * to expose the `getopt_long' or `getopt_long_only' APIs, when * included in this manner. Thus, close the standard __GETOPT_H__ * declarations block, and open an additional __GETOPT_LONG_H__ * specific block, only when *not* __UNISTD_H_SOURCED__, in which * to declare the extended API. */ #endif /* !defined(__GETOPT_H__) */ #if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) #define __GETOPT_LONG_H__ #ifdef __cplusplus extern "C" { #endif struct option /* specification for a long form option... */ { const char *name; /* option name, without leading hyphens */ int has_arg; /* does it take an argument? */ int *flag; /* where to save its status, or NULL */ int val; /* its associated status value */ }; enum /* permitted values for its `has_arg' field... */ { no_argument = 0, /* option never takes an argument */ required_argument, /* option always requires an argument */ optional_argument /* option may take an argument */ }; extern int getopt_long(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx); extern int getopt_long_only(int nargc, char * const *nargv, const char *options, const struct option *long_options, int *idx); /* * Previous MinGW implementation had... */ #ifndef HAVE_DECL_GETOPT /* * ...for the long form API only; keep this for compatibility. */ # define HAVE_DECL_GETOPT 1 #endif #ifdef __cplusplus } #endif #endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */ sassc-3.4.5/win/sassc.sln000066400000000000000000000101471305706433200152740ustar00rootroot00000000000000 Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sassc", "sassc.vcxproj", "{E4030474-AFC9-4CC6-BEB6-D846F631502B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".SolutionItems", ".SolutionItems", "{66CDE359-E53F-46E9-9B1E-EC30B50D30AF}" ProjectSection(SolutionItems) = preProject ..\.editorconfig = ..\.editorconfig ..\.gitignore = ..\.gitignore ..\.travis.yml = ..\.travis.yml ..\appveyor.yml = ..\appveyor.yml ..\LICENSE = ..\LICENSE ..\Readme.md = ..\Readme.md ..\sassc_version.h.in = ..\sassc_version.h.in ..\version.sh = ..\version.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{5CDEB969-5B7C-4653-BD2D-51D0222BD53D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "building", "building", "{1B7DFCCC-9806-43B5-8739-5E2D9C55CE42}" ProjectSection(SolutionItems) = preProject ..\docs\building\unix-instructions.md = ..\docs\building\unix-instructions.md ..\docs\building\windows-instructions.md = ..\docs\building\windows-instructions.md EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testing", "testing", "{4F8D4A73-7FE3-4602-8B46-68FEC98BD69E}" ProjectSection(SolutionItems) = preProject ..\docs\testing\unix-instructions.md = ..\docs\testing\unix-instructions.md ..\docs\testing\windows-instructions.md = ..\docs\testing\windows-instructions.md EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug without static runtime|Win32 = Debug without static runtime|Win32 Debug without static runtime|Win64 = Debug without static runtime|Win64 Debug|Win32 = Debug|Win32 Debug|Win64 = Debug|Win64 Release without static runtime|Win32 = Release without static runtime|Win32 Release without static runtime|Win64 = Release without static runtime|Win64 Release|Win32 = Release|Win32 Release|Win64 = Release|Win64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug without static runtime|Win32.ActiveCfg = Debug without static runtime|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug without static runtime|Win32.Build.0 = Debug without static runtime|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug without static runtime|Win64.ActiveCfg = Debug without static runtime|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug without static runtime|Win64.Build.0 = Debug without static runtime|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug|Win32.ActiveCfg = Debug|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug|Win32.Build.0 = Debug|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug|Win64.ActiveCfg = Debug|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Debug|Win64.Build.0 = Debug|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release without static runtime|Win32.ActiveCfg = Release without static runtime|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release without static runtime|Win32.Build.0 = Release without static runtime|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release without static runtime|Win64.ActiveCfg = Release without static runtime|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release without static runtime|Win64.Build.0 = Release without static runtime|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release|Win32.ActiveCfg = Release|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release|Win32.Build.0 = Release|Win32 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release|Win64.ActiveCfg = Release|x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B}.Release|Win64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {5CDEB969-5B7C-4653-BD2D-51D0222BD53D} = {66CDE359-E53F-46E9-9B1E-EC30B50D30AF} {1B7DFCCC-9806-43B5-8739-5E2D9C55CE42} = {5CDEB969-5B7C-4653-BD2D-51D0222BD53D} {4F8D4A73-7FE3-4602-8B46-68FEC98BD69E} = {5CDEB969-5B7C-4653-BD2D-51D0222BD53D} EndGlobalSection EndGlobal sassc-3.4.5/win/sassc.vcxproj000066400000000000000000000200711305706433200161700ustar00rootroot00000000000000 [NA] [NA] ..\.. $(LIBSASS_DIR)\src $(LIBSASS_DIR)\src $(LIBSASS_DIR)\include %(PreprocessorDefinitions);SASSC_VERSION="$(SASSC_VERSION)" %(PreprocessorDefinitions);LIBSASS_VERSION="$(LIBSASS_VERSION)" Debug Win32 Debug x64 Debug without static runtime Win32 Debug without static runtime x64 Release Win32 Release x64 Release without static runtime Win32 Release without static runtime x64 {E4030474-AFC9-4CC6-BEB6-D846F631502B} Win32Proj libsass Application Unicode sassc $(SolutionDir)..\bin\ $(SolutionDir)..\bin\$(Configuration)\obj\ v120 v140 true true false false true ..;posix;$(LIBSASS_INCLUDES_DIR);$(LIBSASS_HEADERS_DIR);$(LIBSASS_INCLUDES_DIR)\sass;%(AdditionalIncludeDirectories) $(IntDir)/%(RelativeDir)/ $(IntDir)/%(RelativeDir)/ $(IntDir)/%(RelativeDir)/ Level3 Disabled WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) WIN64;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) MultiThreadedDebug Console true Level3 MaxSpeed true true 4194304 WIN32;_CONSOLE;_LIB;%(PreprocessorDefinitions) WIN64;_CONSOLE;_LIB;%(PreprocessorDefinitions) MultiThreadedDebug MultiThreaded true true StreamingSIMDExtensions2 ProgramDatabase Console true true true UseLinkTimeCodeGeneration sassc-3.4.5/win/sassc.vcxproj.filters000066400000000000000000000350261305706433200176450ustar00rootroot00000000000000 {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms {dbdf7aff-4ba7-44ea-a850-2ba5cef9ce28} {80280903-f392-429c-9812-09bb4fdd4b21} {b9d61faa-a8b4-44e5-9e74-58d686989973} {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;xsd {4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files Source Files Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Header Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files LibSass\Source Files