Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
121f32bb
Commit
121f32bb
authored
Jul 12, 2012
by
Aaron Leung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on color name conversion stuff. Not ready yet.
parent
55c191c2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
3 deletions
+26
-3
color_names.hpp
color_names.hpp
+3
-2
context.cpp
context.cpp
+20
-1
context.hpp
context.hpp
+3
-0
No files found.
color_names.hpp
View file @
121f32bb
...
...
@@ -153,7 +153,7 @@ namespace Sass {
"yellowgreen"
,
// sentinel value
0
}
}
;
const
double
color_values
[]
=
{
...
...
@@ -306,6 +306,6 @@ namespace Sass {
0x9a
,
0xcd
,
0x32
,
// sentinel value
0xfff
}
}
;
}
\ No newline at end of file
context.cpp
View file @
121f32bb
...
...
@@ -2,6 +2,7 @@
#include <iostream>
#include <unistd.h>
#include "prelexer.hpp"
#include "color_names.hpp"
using
std
::
cerr
;
using
std
::
endl
;
namespace
Sass
{
...
...
@@ -47,12 +48,15 @@ namespace Sass {
pending_extensions
(
vector
<
pair
<
Node
,
Node
>
>
()),
source_refs
(
vector
<
char
*>
()),
include_paths
(
vector
<
string
>
()),
color_names_to_values
(
map
<
string
,
Node
>
()),
color_values_to_names
(
map
<
Node
,
string
>
()),
new_Node
(
Node_Factory
()),
ref_count
(
0
),
has_extensions
(
false
)
{
register_functions
();
collect_include_paths
(
paths_str
);
setup_color_map
();
}
Context
::~
Context
()
...
...
@@ -60,7 +64,6 @@ namespace Sass {
for
(
size_t
i
=
0
;
i
<
source_refs
.
size
();
++
i
)
{
delete
[]
source_refs
[
i
];
}
new_Node
.
free
();
// cerr << "Deallocated " << i << " source string(s)." << endl;
}
...
...
@@ -149,4 +152,20 @@ namespace Sass {
register_function
(
not_descriptor
,
not_impl
);
}
void
Context
::
setup_color_map
()
{
size_t
i
=
0
;
while
(
color_names
[
i
]
!=
0
)
{
string
name
(
color_names
[
i
]);
Node
value
(
new_Node
(
"[COLOR TABLE]"
,
0
,
color_values
[
i
*
3
],
color_values
[
i
*
3
+
1
],
color_values
[
i
*
3
+
2
],
1
));
color_names_to_values
[
name
]
=
value
;
color_values_to_names
[
value
]
=
name
;
++
i
;
}
}
}
context.hpp
View file @
121f32bb
...
...
@@ -47,6 +47,8 @@ namespace Sass {
vector
<
pair
<
Node
,
Node
>
>
pending_extensions
;
vector
<
char
*>
source_refs
;
// all the source c-strings
vector
<
string
>
include_paths
;
map
<
string
,
Node
>
color_names_to_values
;
map
<
Node
,
string
>
color_values_to_names
;
Node_Factory
new_Node
;
size_t
ref_count
;
string
sass_path
;
...
...
@@ -61,6 +63,7 @@ namespace Sass {
void
register_function
(
Function_Descriptor
d
,
Primitive
ip
,
size_t
arity
);
void
register_overload_stub
(
string
name
);
void
register_functions
();
void
setup_color_map
();
};
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment