mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-02 01:48:42 +03:00
update src
This commit is contained in:
@@ -230,6 +230,16 @@ if (WIN32)
|
|||||||
|
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
|
if (NOT APPLE AND NOT FLATPAK)
|
||||||
|
set(output_sos_Release "")
|
||||||
|
set(output_sos_Debug "")
|
||||||
|
add_custom_target(QIDIStudioSosCopy ALL DEPENDS QIDIStudio)
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
|
qidistudio_copy_sos(QIDIStudioSosCopy "Debug" "d" output_sos_Debug)
|
||||||
|
else()
|
||||||
|
qidistudio_copy_sos(QIDIStudioSosCopy "Release" "" output_sos_Release)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
if (APPLE AND NOT CMAKE_MACOSX_BUNDLE)
|
if (APPLE AND NOT CMAKE_MACOSX_BUNDLE)
|
||||||
# On OSX, the name of the binary matches the name of the Application.
|
# On OSX, the name of the binary matches the name of the Application.
|
||||||
add_custom_command(TARGET QIDIStudio POST_BUILD
|
add_custom_command(TARGET QIDIStudio POST_BUILD
|
||||||
@@ -288,5 +298,9 @@ if (WIN32)
|
|||||||
endif ()
|
endif ()
|
||||||
install(FILES ${output_dlls_${build_type}} DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
install(FILES ${output_dlls_${build_type}} DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
else ()
|
else ()
|
||||||
|
if (APPLE)
|
||||||
|
else()
|
||||||
|
install(FILES ${output_sos_${build_type}} DESTINATION "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
endif()
|
||||||
install(TARGETS QIDIStudio RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS QIDIStudio RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -145,7 +145,8 @@ std::map<int, std::string> cli_errors = {
|
|||||||
{CLI_OBJECT_COLLISION_IN_LAYER_PRINT, "Object conflicts were detected. Please verify the slicing of all plates in QIDI Studio before uploading."},
|
{CLI_OBJECT_COLLISION_IN_LAYER_PRINT, "Object conflicts were detected. Please verify the slicing of all plates in QIDI Studio before uploading."},
|
||||||
{CLI_SPIRAL_MODE_INVALID_PARAMS, "Some slicing parameters cannot work with Spiral Vase mode. Please solve the issue in QIDI Studio before uploading."},
|
{CLI_SPIRAL_MODE_INVALID_PARAMS, "Some slicing parameters cannot work with Spiral Vase mode. Please solve the issue in QIDI Studio before uploading."},
|
||||||
{CLI_SLICING_ERROR, "Failed slicing the model. Please verify the slicing of all plates on QIDI Studio before uploading."},
|
{CLI_SLICING_ERROR, "Failed slicing the model. Please verify the slicing of all plates on QIDI Studio before uploading."},
|
||||||
{CLI_GCODE_PATH_CONFLICTS, " G-code conflicts detected after slicing. Please make sure the 3mf file can be successfully sliced in the latest QIDI Studio."}
|
{CLI_GCODE_PATH_CONFLICTS, " G-code conflicts detected after slicing. Please make sure the 3mf file can be successfully sliced in the latest QIDI Studio."},
|
||||||
|
{CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER, "Found some filament unprintable at first layer on current Plate. Please make sure the 3mf file can be successfully sliced with the same Plate type in the latest QIDI Studio."}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _sliced_plate_info{
|
typedef struct _sliced_plate_info{
|
||||||
@@ -651,6 +652,11 @@ static int load_assemble_plate_list(std::string config_file, std::vector<assembl
|
|||||||
return CLI_CONFIG_FILE_ERROR;
|
return CLI_CONFIG_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (object_json.contains(JSON_ASSEMPLE_SUBTYPE))
|
||||||
|
assemble_object.subtype = ModelVolume::type_from_string(object_json[JSON_ASSEMPLE_SUBTYPE]);
|
||||||
|
else
|
||||||
|
assemble_object.subtype = ModelVolumeType::MODEL_PART;
|
||||||
|
|
||||||
assemble_object.filaments = object_json.at(JSON_ASSEMPLE_OBJECT_FILAMENTS).get<std::vector<int>>();
|
assemble_object.filaments = object_json.at(JSON_ASSEMPLE_OBJECT_FILAMENTS).get<std::vector<int>>();
|
||||||
if ((assemble_object.filaments.size() > 0) && (assemble_object.filaments.size() != assemble_object.count) && (assemble_object.filaments.size() != 1))
|
if ((assemble_object.filaments.size() > 0) && (assemble_object.filaments.size() != assemble_object.count) && (assemble_object.filaments.size() != 1))
|
||||||
{
|
{
|
||||||
@@ -751,7 +757,7 @@ static int load_assemble_plate_list(std::string config_file, std::vector<assembl
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void merge_or_add_object(assemble_plate_info_t& assemble_plate_info, Model &model, int assemble_index, std::map<int, ModelObject*> &merged_objects, ModelObject *ori_object)
|
void merge_or_add_object(assemble_plate_info_t& assemble_plate_info, Model &model, int assemble_index, std::map<int, ModelObject*> &merged_objects, ModelObject *ori_object, ModelVolumeType type)
|
||||||
{
|
{
|
||||||
if (assemble_index > 0) {
|
if (assemble_index > 0) {
|
||||||
auto iter = merged_objects.find(assemble_index);
|
auto iter = merged_objects.find(assemble_index);
|
||||||
@@ -762,17 +768,21 @@ void merge_or_add_object(assemble_plate_info_t& assemble_plate_info, Model &mode
|
|||||||
new_object->name = "assemble_" + std::to_string(assemble_index);
|
new_object->name = "assemble_" + std::to_string(assemble_index);
|
||||||
merged_objects[assemble_index] = new_object;
|
merged_objects[assemble_index] = new_object;
|
||||||
assemble_plate_info.loaded_obj_list.emplace_back(new_object);
|
assemble_plate_info.loaded_obj_list.emplace_back(new_object);
|
||||||
new_object->config.assign_config(ori_object->config.get());
|
//new_object->config.assign_config(ori_object->config.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
new_object = iter->second;
|
new_object = iter->second;
|
||||||
|
|
||||||
for (auto volume : ori_object->volumes) {
|
for (auto volume : ori_object->volumes) {
|
||||||
ModelVolume* new_volume = new_object->add_volume(*volume);
|
ModelVolume* new_volume = new_object->add_volume(*volume, type);
|
||||||
// set extruder id
|
// set extruder id
|
||||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(ori_object->config.extruder()));
|
//new_volume->config.set_key_value("extruder", new ConfigOptionInt(ori_object->config.extruder()));
|
||||||
|
if (type == ModelVolumeType::MODEL_PART || type == ModelVolumeType::PARAMETER_MODIFIER)
|
||||||
|
{
|
||||||
|
new_volume->config.apply(ori_object->config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(debug) << boost::format("assemble_index %1%, name %2%, merged to new model %3%") % assemble_index % ori_object->name % new_object->name;
|
BOOST_LOG_TRIVIAL(debug) << boost::format("assemble_index %1%, name %2%, merged to new model %3%, subtype %4%") % assemble_index % ori_object->name % new_object->name %(int)type;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ModelObject* new_object = model.add_object(*ori_object);
|
ModelObject* new_object = model.add_object(*ori_object);
|
||||||
@@ -932,7 +942,7 @@ static int construct_assemble_list(std::vector<assemble_plate_info_t>& assemble_
|
|||||||
return CLI_DATA_FILE_ERROR;
|
return CLI_DATA_FILE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (boost::algorithm::iends_with(assemble_object.path, ".obj"))
|
else if ((boost::algorithm::iends_with(assemble_object.path, ".obj")) && assemble_object.subtype == ModelVolumeType::MODEL_PART)
|
||||||
{
|
{
|
||||||
std::string message;
|
std::string message;
|
||||||
ObjInfo obj_info;
|
ObjInfo obj_info;
|
||||||
@@ -982,7 +992,7 @@ static int construct_assemble_list(std::vector<assemble_plate_info_t>& assemble_
|
|||||||
obj_temp_model.clear_materials();
|
obj_temp_model.clear_materials();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": unsupported file %1%, plate index %2%, object index %3%") % assemble_object.path % (index + 1) % (obj_index + 1);
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": unsupported file %1%, plate index %2%, object index %3%, subtype %4%") % assemble_object.path % (index + 1) % (obj_index + 1) %(int)(assemble_object.subtype);
|
||||||
return CLI_INVALID_PARAMS;
|
return CLI_INVALID_PARAMS;
|
||||||
}
|
}
|
||||||
//1.9.5
|
//1.9.5
|
||||||
@@ -1008,6 +1018,10 @@ static int construct_assemble_list(std::vector<assemble_plate_info_t>& assemble_
|
|||||||
|
|
||||||
if (!assemble_object.height_ranges.empty())
|
if (!assemble_object.height_ranges.empty())
|
||||||
{
|
{
|
||||||
|
if (assemble_object.subtype != ModelVolumeType::MODEL_PART) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": only normal part can have height ranges, file %1%, plate index %2%, object index %3%, subtype %4%") % assemble_object.path % (index + 1) % (obj_index + 1) %(int)(assemble_object.subtype);
|
||||||
|
return CLI_INVALID_PARAMS;
|
||||||
|
}
|
||||||
for (int range_index = 0; range_index < assemble_object.height_ranges.size(); range_index++)
|
for (int range_index = 0; range_index < assemble_object.height_ranges.size(); range_index++)
|
||||||
{
|
{
|
||||||
height_range_info_t& range = assemble_object.height_ranges[range_index];
|
height_range_info_t& range = assemble_object.height_ranges[range_index];
|
||||||
@@ -1027,11 +1041,21 @@ static int construct_assemble_list(std::vector<assemble_plate_info_t>& assemble_
|
|||||||
assemble_object.pos_y.resize(1, 0.f);
|
assemble_object.pos_y.resize(1, 0.f);
|
||||||
if (assemble_object.pos_z.empty())
|
if (assemble_object.pos_z.empty())
|
||||||
assemble_object.pos_z.resize(1, 0.f);
|
assemble_object.pos_z.resize(1, 0.f);
|
||||||
if (assemble_object.assemble_index.empty())
|
if (assemble_object.assemble_index.empty()) {
|
||||||
|
if (assemble_object.subtype != ModelVolumeType::MODEL_PART) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": only normal part can be used as individual object, file %1%, plate index %2%, object index %3%, subtype %4%") % assemble_object.path % (index + 1) % (obj_index + 1) %(int)(assemble_object.subtype);
|
||||||
|
return CLI_INVALID_PARAMS;
|
||||||
|
}
|
||||||
assemble_object.assemble_index.resize(1, 0);
|
assemble_object.assemble_index.resize(1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((assemble_object.subtype != ModelVolumeType::MODEL_PART)&&(assemble_object.assemble_index[0] == 0)) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": only normal part can have height ranges, file %1%, plate index %2%, object index %3%, subtype %4%") % assemble_object.path % (index + 1) % (obj_index + 1) %(int)(assemble_object.subtype);
|
||||||
|
return CLI_INVALID_PARAMS;
|
||||||
|
}
|
||||||
|
|
||||||
object->translate(assemble_object.pos_x[0], assemble_object.pos_y[0], assemble_object.pos_z[0]);
|
object->translate(assemble_object.pos_x[0], assemble_object.pos_y[0], assemble_object.pos_z[0]);
|
||||||
merge_or_add_object(assemble_plate_info, model, assemble_object.assemble_index[0], merged_objects, object);
|
merge_or_add_object(assemble_plate_info, model, assemble_object.assemble_index[0], merged_objects, object, assemble_object.subtype);
|
||||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": object %1%, name %2%, pos_x %3% pos_y %4%, pos_z %5%, filament %6%, assemble_index %7%")
|
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": object %1%, name %2%, pos_x %3% pos_y %4%, pos_z %5%, filament %6%, assemble_index %7%")
|
||||||
%obj_index %object->name %assemble_object.pos_x[0] %assemble_object.pos_y[0] %assemble_object.pos_z[0] %assemble_object.filaments[0] %assemble_object.assemble_index[0];
|
%obj_index %object->name %assemble_object.pos_x[0] %assemble_object.pos_y[0] %assemble_object.pos_z[0] %assemble_object.filaments[0] %assemble_object.assemble_index[0];
|
||||||
|
|
||||||
@@ -1063,7 +1087,13 @@ static int construct_assemble_list(std::vector<assemble_plate_info_t>& assemble_
|
|||||||
array_index = copy_index;
|
array_index = copy_index;
|
||||||
else
|
else
|
||||||
array_index = 0;
|
array_index = 0;
|
||||||
merge_or_add_object(assemble_plate_info, model, assemble_object.assemble_index[array_index], merged_objects, copy_obj);
|
|
||||||
|
if ((assemble_object.subtype != ModelVolumeType::MODEL_PART)&&(assemble_object.assemble_index[array_index] == 0)) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": only normal part can have height ranges, file %1%, plate index %2%, object index %3%, subtype %4%, copy_index %5%")
|
||||||
|
% assemble_object.path % (index + 1) % (obj_index + 1) %(int)(assemble_object.subtype) %copy_index;
|
||||||
|
return CLI_INVALID_PARAMS;
|
||||||
|
}
|
||||||
|
merge_or_add_object(assemble_plate_info, model, assemble_object.assemble_index[array_index], merged_objects, copy_obj, assemble_object.subtype);
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": cloned object %1%, name %2%, pos_x %3% pos_y %4%, pos_z %5%")
|
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(": cloned object %1%, name %2%, pos_x %3% pos_y %4%, pos_z %5%")
|
||||||
%copy_index %object->name %assemble_object.pos_x[array_index] %assemble_object.pos_y[array_index] %assemble_object.pos_z[array_index];
|
%copy_index %object->name %assemble_object.pos_x[array_index] %assemble_object.pos_y[array_index] %assemble_object.pos_z[array_index];
|
||||||
@@ -1264,6 +1294,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
const std::vector<std::string> &uptodate_filaments = m_config.option<ConfigOptionStrings>("uptodate_filaments", true)->values;
|
const std::vector<std::string> &uptodate_filaments = m_config.option<ConfigOptionStrings>("uptodate_filaments", true)->values;
|
||||||
std::vector<std::string> downward_settings = m_config.option<ConfigOptionStrings>("downward_settings", true)->values;
|
std::vector<std::string> downward_settings = m_config.option<ConfigOptionStrings>("downward_settings", true)->values;
|
||||||
std::vector<std::string> downward_compatible_machines;
|
std::vector<std::string> downward_compatible_machines;
|
||||||
|
std::set<std::string> downward_uncompatible_machines;
|
||||||
//QDS: always use ForwardCompatibilitySubstitutionRule::Enable
|
//QDS: always use ForwardCompatibilitySubstitutionRule::Enable
|
||||||
//const ForwardCompatibilitySubstitutionRule config_substitution_rule = m_config.option<ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>>("config_compatibility", true)->value;
|
//const ForwardCompatibilitySubstitutionRule config_substitution_rule = m_config.option<ConfigOptionEnum<ForwardCompatibilitySubstitutionRule>>("config_compatibility", true)->value;
|
||||||
const ForwardCompatibilitySubstitutionRule config_substitution_rule = ForwardCompatibilitySubstitutionRule::Enable;
|
const ForwardCompatibilitySubstitutionRule config_substitution_rule = ForwardCompatibilitySubstitutionRule::Enable;
|
||||||
@@ -1350,7 +1381,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
//QDS: add plate data related logic
|
//QDS: add plate data related logic
|
||||||
PlateDataPtrs plate_data_src;
|
PlateDataPtrs plate_data_src;
|
||||||
std::vector<plate_obj_size_info_t> plate_obj_size_infos;
|
std::vector<plate_obj_size_info_t> plate_obj_size_infos;
|
||||||
int arrange_option;
|
//int arrange_option;
|
||||||
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0;
|
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0;
|
||||||
bool first_file = true, is_qdt_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
|
bool first_file = true, is_qdt_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
|
||||||
bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false;
|
bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false;
|
||||||
@@ -1550,7 +1581,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
// QDS: adjust whebackup
|
// QDS: adjust whebackup
|
||||||
//LoadStrategy strategy = LoadStrategy::LoadModel | LoadStrategy::LoadConfig|LoadStrategy::AddDefaultInstances;
|
//LoadStrategy strategy = LoadStrategy::LoadModel | LoadStrategy::LoadConfig|LoadStrategy::AddDefaultInstances;
|
||||||
//if (load_aux) strategy = strategy | LoadStrategy::LoadAuxiliary;
|
//if (load_aux) strategy = strategy | LoadStrategy::LoadAuxiliary;
|
||||||
model = Model::read_from_file(file, &config, &config_substitutions, strategy, &plate_data_src, &project_presets, &is_qdt_3mf, &file_version, nullptr, nullptr, nullptr, nullptr, nullptr, plate_to_slice);
|
model = Model::read_from_file(file, &config, &config_substitutions, strategy, &plate_data_src, &project_presets, &is_qdt_3mf, &file_version, nullptr, nullptr, nullptr, plate_to_slice);
|
||||||
if (is_qdt_3mf)
|
if (is_qdt_3mf)
|
||||||
{
|
{
|
||||||
if (!first_file)
|
if (!first_file)
|
||||||
@@ -1708,7 +1739,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
ModelObject* object = model.objects[obj_index];
|
ModelObject* object = model.objects[obj_index];
|
||||||
|
|
||||||
for (unsigned int clone_index = 1; clone_index < clone_count; clone_index++)
|
for (int clone_index = 1; clone_index < clone_count; clone_index++)
|
||||||
{
|
{
|
||||||
ModelObject* newObj = model.add_object(*object);
|
ModelObject* newObj = model.add_object(*object);
|
||||||
newObj->name = object->name +"_"+ std::to_string(clone_index+1);
|
newObj->name = object->name +"_"+ std::to_string(clone_index+1);
|
||||||
@@ -3642,19 +3673,29 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (failed_count < downward_check_size)
|
|
||||||
|
for (int index2 = 0; index2 < downward_check_size; index2 ++)
|
||||||
{
|
{
|
||||||
//has success ones
|
printer_plate_info_t& plate_info = downward_check_printers[index2];
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: downward_check_size %1%, failed_count %2%")%downward_check_size %failed_count;
|
if (downward_check_status[index2]) {
|
||||||
for (int index2 = 0; index2 < downward_check_size; index2 ++)
|
downward_uncompatible_machines.emplace(plate_info.printer_name);
|
||||||
{
|
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: found uncompatible printer %1%")%plate_info.printer_name;
|
||||||
if (downward_check_status[index2])
|
}
|
||||||
continue;
|
else {
|
||||||
printer_plate_info_t& plate_info = downward_check_printers[index2];
|
downward_compatible_machines.push_back(plate_info.printer_name);
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: found compatible printer %1%")%plate_info.printer_name;
|
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: found compatible printer %1%")%plate_info.printer_name;
|
||||||
downward_compatible_machines.push_back(plate_info.printer_name);
|
}
|
||||||
|
}
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: downward_check_size %1%, failed_count %2%")%downward_check_size %failed_count;
|
||||||
|
sliced_info.downward_machines = downward_compatible_machines;
|
||||||
|
|
||||||
|
for(std::vector<std::string>::iterator it = sliced_info.upward_machines.begin(); it != sliced_info.upward_machines.end();){
|
||||||
|
if(downward_uncompatible_machines.find(*it) != downward_uncompatible_machines.end()){
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: remove %1% from upward compatible printers")%*it;
|
||||||
|
it = sliced_info.upward_machines.erase(it);
|
||||||
|
} else {
|
||||||
|
it ++;
|
||||||
}
|
}
|
||||||
sliced_info.downward_machines = downward_compatible_machines;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4176,12 +4217,11 @@ int CLI::run(int argc, char **argv)
|
|||||||
arrange_cfg.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
arrange_cfg.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangement::update_arrange_params(arrange_cfg, &m_print_config, selected);
|
arrangement::update_arrange_params(arrange_cfg, m_print_config, selected);
|
||||||
arrangement::update_selected_items_inflation(selected, &m_print_config, arrange_cfg);
|
arrangement::update_selected_items_inflation(selected, m_print_config, arrange_cfg);
|
||||||
arrangement::update_unselected_items_inflation(unselected, &m_print_config, arrange_cfg);
|
arrangement::update_unselected_items_inflation(unselected, m_print_config, arrange_cfg);
|
||||||
arrangement::update_selected_items_axis_align(selected, &m_print_config, arrange_cfg);
|
|
||||||
|
|
||||||
beds = get_shrink_bedpts(&m_print_config, arrange_cfg);
|
beds = get_shrink_bedpts(m_print_config, arrange_cfg);
|
||||||
|
|
||||||
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, 1, scale_(1));
|
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, 1, scale_(1));
|
||||||
|
|
||||||
@@ -4577,12 +4617,11 @@ int CLI::run(int argc, char **argv)
|
|||||||
arrange_cfg.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
arrange_cfg.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangement::update_arrange_params(arrange_cfg, &m_print_config, selected);
|
arrangement::update_arrange_params(arrange_cfg, m_print_config, selected);
|
||||||
arrangement::update_selected_items_inflation(selected, &m_print_config, arrange_cfg);
|
arrangement::update_selected_items_inflation(selected, m_print_config, arrange_cfg);
|
||||||
arrangement::update_unselected_items_inflation(unselected, &m_print_config, arrange_cfg);
|
arrangement::update_unselected_items_inflation(unselected, m_print_config, arrange_cfg);
|
||||||
arrangement::update_selected_items_axis_align(selected, &m_print_config, arrange_cfg);
|
|
||||||
|
|
||||||
beds=get_shrink_bedpts(&m_print_config, arrange_cfg);
|
beds=get_shrink_bedpts(m_print_config, arrange_cfg);
|
||||||
|
|
||||||
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, 1, scale_(1));
|
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, 1, scale_(1));
|
||||||
|
|
||||||
@@ -4987,7 +5026,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
// continue;
|
// continue;
|
||||||
for (int instance_idx = 0; instance_idx < (int)model_object.instances.size(); ++ instance_idx) {
|
for (int instance_idx = 0; instance_idx < (int)model_object.instances.size(); ++ instance_idx) {
|
||||||
const ModelInstance &model_instance = *model_object.instances[instance_idx];
|
const ModelInstance &model_instance = *model_object.instances[instance_idx];
|
||||||
glvolume_collection.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, "volume", true, false, true);
|
glvolume_collection.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, "volume", true, false, true, false);
|
||||||
//glvolume_collection.volumes.back()->geometry_id = key.geometry_id;
|
//glvolume_collection.volumes.back()->geometry_id = key.geometry_id;
|
||||||
std::string color = filament_color?filament_color->get_at(volume_extruder_id - 1):"#00FF00FF";
|
std::string color = filament_color?filament_color->get_at(volume_extruder_id - 1):"#00FF00FF";
|
||||||
|
|
||||||
@@ -5370,14 +5409,14 @@ int CLI::run(int argc, char **argv)
|
|||||||
bool is_qdt_vendor_preset = false;
|
bool is_qdt_vendor_preset = false;
|
||||||
|
|
||||||
if (!printer_model_string.empty()) {
|
if (!printer_model_string.empty()) {
|
||||||
is_qdt_vendor_preset = (printer_model_string.compare(0, 9, "QIDI Lab") == 0);
|
is_qdt_vendor_preset = (printer_model_string.compare(0, 9, "QIDI Tech") == 0);
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("printer_model_string: %1%, is_qdt_vendor_preset %2%")%printer_model_string %is_qdt_vendor_preset;
|
BOOST_LOG_TRIVIAL(info) << boost::format("printer_model_string: %1%, is_qdt_vendor_preset %2%")%printer_model_string %is_qdt_vendor_preset;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!new_printer_name.empty())
|
if (!new_printer_name.empty())
|
||||||
is_qdt_vendor_preset = (new_printer_name.compare(0, 9, "QIDI Lab") == 0);
|
is_qdt_vendor_preset = (new_printer_name.compare(0, 9, "QIDI Tech") == 0);
|
||||||
else if (!current_printer_system_name.empty())
|
else if (!current_printer_system_name.empty())
|
||||||
is_qdt_vendor_preset = (current_printer_system_name.compare(0, 9, "QIDI Lab") == 0);
|
is_qdt_vendor_preset = (current_printer_system_name.compare(0, 9, "QIDI Tech") == 0);
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("new_printer_name: %1%, current_printer_system_name %2%, is_qdt_vendor_preset %3%")%new_printer_name %current_printer_system_name %is_qdt_vendor_preset;
|
BOOST_LOG_TRIVIAL(info) << boost::format("new_printer_name: %1%, current_printer_system_name %2%, is_qdt_vendor_preset %3%")%new_printer_name %current_printer_system_name %is_qdt_vendor_preset;
|
||||||
}
|
}
|
||||||
(dynamic_cast<Print*>(print))->set_QDT_Printer(is_qdt_vendor_preset);
|
(dynamic_cast<Print*>(print))->set_QDT_Printer(is_qdt_vendor_preset);
|
||||||
@@ -5508,6 +5547,13 @@ int CLI::run(int argc, char **argv)
|
|||||||
slice_time[TIME_USING_CACHE] = slice_time[TIME_USING_CACHE] + ((long long)Slic3r::Utils::get_current_milliseconds_time_utc() - temp_time);
|
slice_time[TIME_USING_CACHE] = slice_time[TIME_USING_CACHE] + ((long long)Slic3r::Utils::get_current_milliseconds_time_utc() - temp_time);
|
||||||
BOOST_LOG_TRIVIAL(info) << "export_gcode finished: time_using_cache update to " << slice_time[TIME_USING_CACHE] << " secs.";
|
BOOST_LOG_TRIVIAL(info) << "export_gcode finished: time_using_cache update to " << slice_time[TIME_USING_CACHE] << " secs.";
|
||||||
|
|
||||||
|
if (gcode_result && gcode_result->filament_printable_reuslt.has_value()) {
|
||||||
|
//found gcode error
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "plate " << index + 1 << ": found some filament unprintable on current bed- "<< gcode_result->filament_printable_reuslt.plate_name << std::endl;
|
||||||
|
record_exit_reson(outfile_dir, CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER, index + 1, cli_errors[CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER], sliced_info);
|
||||||
|
flush_and_exit(CLI_FILAMENT_UNPRINTABLE_ON_FIRST_LAYER);
|
||||||
|
}
|
||||||
|
|
||||||
//outfile_final = (dynamic_cast<Print*>(print))->print_statistics().finalize_output_path(outfile);
|
//outfile_final = (dynamic_cast<Print*>(print))->print_statistics().finalize_output_path(outfile);
|
||||||
//m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); });
|
//m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); });
|
||||||
}/* else {
|
}/* else {
|
||||||
@@ -5868,7 +5914,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
// continue;
|
// continue;
|
||||||
for (int instance_idx = 0; instance_idx < (int)model_object.instances.size(); ++ instance_idx) {
|
for (int instance_idx = 0; instance_idx < (int)model_object.instances.size(); ++ instance_idx) {
|
||||||
const ModelInstance &model_instance = *model_object.instances[instance_idx];
|
const ModelInstance &model_instance = *model_object.instances[instance_idx];
|
||||||
glvolume_collection.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, "volume", true, false, true);
|
glvolume_collection.load_object_volume(&model_object, obj_idx, volume_idx, instance_idx, "volume", true, false, true, false);
|
||||||
//glvolume_collection.volumes.back()->geometry_id = key.geometry_id;
|
//glvolume_collection.volumes.back()->geometry_id = key.geometry_id;
|
||||||
std::string color = filament_color?filament_color->get_at(volume_extruder_id - 1):"#00FF00FF";
|
std::string color = filament_color?filament_color->get_at(volume_extruder_id - 1):"#00FF00FF";
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace IO {
|
|||||||
#define JSON_ASSEMPLE_PLATE_NAME "plate_name"
|
#define JSON_ASSEMPLE_PLATE_NAME "plate_name"
|
||||||
#define JSON_ASSEMPLE_PLATE_NEED_ARRANGE "need_arrange"
|
#define JSON_ASSEMPLE_PLATE_NEED_ARRANGE "need_arrange"
|
||||||
#define JSON_ASSEMPLE_OBJECTS "objects"
|
#define JSON_ASSEMPLE_OBJECTS "objects"
|
||||||
|
#define JSON_ASSEMPLE_SUBTYPE "subtype"
|
||||||
#define JSON_ASSEMPLE_OBJECT_PATH "path"
|
#define JSON_ASSEMPLE_OBJECT_PATH "path"
|
||||||
#define JSON_ASSEMPLE_OBJECT_COUNT "count"
|
#define JSON_ASSEMPLE_OBJECT_COUNT "count"
|
||||||
#define JSON_ASSEMPLE_OBJECT_FILAMENTS "filaments"
|
#define JSON_ASSEMPLE_OBJECT_FILAMENTS "filaments"
|
||||||
@@ -52,6 +53,7 @@ typedef struct _assembled_param_info {
|
|||||||
|
|
||||||
typedef struct _assemble_object_info {
|
typedef struct _assemble_object_info {
|
||||||
std::string path;
|
std::string path;
|
||||||
|
ModelVolumeType subtype;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
std::vector<int> filaments;
|
std::vector<int> filaments;
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
|
|
||||||
Copyright (c) 2001-2016 Expat maintainers
|
|
||||||
|
|
||||||
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.
|
|
||||||
146
src/expat/README
146
src/expat/README
@@ -1,146 +0,0 @@
|
|||||||
Expat, Release 2.2.0, stripped and modified for inclusion into Slic3r.
|
|
||||||
Only the library sources needed for static linking were left.
|
|
||||||
|
|
||||||
The original README follows:
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Expat, Release 2.2.0
|
|
||||||
|
|
||||||
This is Expat, a C library for parsing XML, written by James Clark.
|
|
||||||
Expat is a stream-oriented XML parser. This means that you register
|
|
||||||
handlers with the parser before starting the parse. These handlers
|
|
||||||
are called when the parser discovers the associated structures in the
|
|
||||||
document being parsed. A start tag is an example of the kind of
|
|
||||||
structures for which you may register handlers.
|
|
||||||
|
|
||||||
Windows users should use the expat_win32bin package, which includes
|
|
||||||
both precompiled libraries and executables, and source code for
|
|
||||||
developers.
|
|
||||||
|
|
||||||
Expat is free software. You may copy, distribute, and modify it under
|
|
||||||
the terms of the License contained in the file COPYING distributed
|
|
||||||
with this package. This license is the same as the MIT/X Consortium
|
|
||||||
license.
|
|
||||||
|
|
||||||
Versions of Expat that have an odd minor version (the middle number in
|
|
||||||
the release above), are development releases and should be considered
|
|
||||||
as beta software. Releases with even minor version numbers are
|
|
||||||
intended to be production grade software.
|
|
||||||
|
|
||||||
If you are building Expat from a check-out from the CVS repository,
|
|
||||||
you need to run a script that generates the configure script using the
|
|
||||||
GNU autoconf and libtool tools. To do this, you need to have
|
|
||||||
autoconf 2.58 or newer. Run the script like this:
|
|
||||||
|
|
||||||
./buildconf.sh
|
|
||||||
|
|
||||||
Once this has been done, follow the same instructions as for building
|
|
||||||
from a source distribution.
|
|
||||||
|
|
||||||
To build Expat from a source distribution, you first run the
|
|
||||||
configuration shell script in the top level distribution directory:
|
|
||||||
|
|
||||||
./configure
|
|
||||||
|
|
||||||
There are many options which you may provide to configure (which you
|
|
||||||
can discover by running configure with the --help option). But the
|
|
||||||
one of most interest is the one that sets the installation directory.
|
|
||||||
By default, the configure script will set things up to install
|
|
||||||
libexpat into /usr/local/lib, expat.h into /usr/local/include, and
|
|
||||||
xmlwf into /usr/local/bin. If, for example, you'd prefer to install
|
|
||||||
into /home/me/mystuff/lib, /home/me/mystuff/include, and
|
|
||||||
/home/me/mystuff/bin, you can tell configure about that with:
|
|
||||||
|
|
||||||
./configure --prefix=/home/me/mystuff
|
|
||||||
|
|
||||||
Another interesting option is to enable 64-bit integer support for
|
|
||||||
line and column numbers and the over-all byte index:
|
|
||||||
|
|
||||||
./configure CPPFLAGS=-DXML_LARGE_SIZE
|
|
||||||
|
|
||||||
However, such a modification would be a breaking change to the ABI
|
|
||||||
and is therefore not recommended for general use - e.g. as part of
|
|
||||||
a Linux distribution - but rather for builds with special requirements.
|
|
||||||
|
|
||||||
After running the configure script, the "make" command will build
|
|
||||||
things and "make install" will install things into their proper
|
|
||||||
location. Have a look at the "Makefile" to learn about additional
|
|
||||||
"make" options. Note that you need to have write permission into
|
|
||||||
the directories into which things will be installed.
|
|
||||||
|
|
||||||
If you are interested in building Expat to provide document
|
|
||||||
information in UTF-16 encoding rather than the default UTF-8, follow
|
|
||||||
these instructions (after having run "make distclean"):
|
|
||||||
|
|
||||||
1. For UTF-16 output as unsigned short (and version/error
|
|
||||||
strings as char), run:
|
|
||||||
|
|
||||||
./configure CPPFLAGS=-DXML_UNICODE
|
|
||||||
|
|
||||||
For UTF-16 output as wchar_t (incl. version/error strings),
|
|
||||||
run:
|
|
||||||
|
|
||||||
./configure CFLAGS="-g -O2 -fshort-wchar" \
|
|
||||||
CPPFLAGS=-DXML_UNICODE_WCHAR_T
|
|
||||||
|
|
||||||
2. Edit the MakeFile, changing:
|
|
||||||
|
|
||||||
LIBRARY = libexpat.la
|
|
||||||
|
|
||||||
to:
|
|
||||||
|
|
||||||
LIBRARY = libexpatw.la
|
|
||||||
|
|
||||||
(Note the additional "w" in the library name.)
|
|
||||||
|
|
||||||
3. Run "make buildlib" (which builds the library only).
|
|
||||||
Or, to save step 2, run "make buildlib LIBRARY=libexpatw.la".
|
|
||||||
|
|
||||||
4. Run "make installlib" (which installs the library only).
|
|
||||||
Or, if step 2 was omitted, run "make installlib LIBRARY=libexpatw.la".
|
|
||||||
|
|
||||||
Using DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default
|
|
||||||
value for DESTDIR, and the rest of the make file using only DESTDIR.
|
|
||||||
It works as follows:
|
|
||||||
$ make install DESTDIR=/path/to/image
|
|
||||||
overrides the in-makefile set DESTDIR, while both
|
|
||||||
$ INSTALL_ROOT=/path/to/image make install
|
|
||||||
$ make install INSTALL_ROOT=/path/to/image
|
|
||||||
use DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the
|
|
||||||
environment, because variable-setting priority is
|
|
||||||
1) commandline
|
|
||||||
2) in-makefile
|
|
||||||
3) environment
|
|
||||||
|
|
||||||
Note: This only applies to the Expat library itself, building UTF-16 versions
|
|
||||||
of xmlwf and the tests is currently not supported.
|
|
||||||
|
|
||||||
Note for Solaris users: The "ar" command is usually located in
|
|
||||||
"/usr/ccs/bin", which is not in the default PATH. You will need to
|
|
||||||
add this to your path for the "make" command, and probably also switch
|
|
||||||
to GNU make (the "make" found in /usr/ccs/bin does not seem to work
|
|
||||||
properly -- apparently it does not understand .PHONY directives). If
|
|
||||||
you're using ksh or bash, use this command to build:
|
|
||||||
|
|
||||||
PATH=/usr/ccs/bin:$PATH make
|
|
||||||
|
|
||||||
When using Expat with a project using autoconf for configuration, you
|
|
||||||
can use the probing macro in conftools/expat.m4 to determine how to
|
|
||||||
include Expat. See the comments at the top of that file for more
|
|
||||||
information.
|
|
||||||
|
|
||||||
A reference manual is available in the file doc/reference.html in this
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
The homepage for this project is http://www.libexpat.org/. There
|
|
||||||
are links there to connect you to the bug reports page. If you need
|
|
||||||
to report a bug when you don't have access to a browser, you may also
|
|
||||||
send a bug report by email to expat-bugs@mail.libexpat.org.
|
|
||||||
|
|
||||||
Discussion related to the direction of future expat development takes
|
|
||||||
place on expat-discuss@mail.libexpat.org. Archives of this list and
|
|
||||||
other Expat-related lists may be found at:
|
|
||||||
|
|
||||||
http://mail.libexpat.org/mailman/listinfo/
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define ASCII_A 0x41
|
|
||||||
#define ASCII_B 0x42
|
|
||||||
#define ASCII_C 0x43
|
|
||||||
#define ASCII_D 0x44
|
|
||||||
#define ASCII_E 0x45
|
|
||||||
#define ASCII_F 0x46
|
|
||||||
#define ASCII_G 0x47
|
|
||||||
#define ASCII_H 0x48
|
|
||||||
#define ASCII_I 0x49
|
|
||||||
#define ASCII_J 0x4A
|
|
||||||
#define ASCII_K 0x4B
|
|
||||||
#define ASCII_L 0x4C
|
|
||||||
#define ASCII_M 0x4D
|
|
||||||
#define ASCII_N 0x4E
|
|
||||||
#define ASCII_O 0x4F
|
|
||||||
#define ASCII_P 0x50
|
|
||||||
#define ASCII_Q 0x51
|
|
||||||
#define ASCII_R 0x52
|
|
||||||
#define ASCII_S 0x53
|
|
||||||
#define ASCII_T 0x54
|
|
||||||
#define ASCII_U 0x55
|
|
||||||
#define ASCII_V 0x56
|
|
||||||
#define ASCII_W 0x57
|
|
||||||
#define ASCII_X 0x58
|
|
||||||
#define ASCII_Y 0x59
|
|
||||||
#define ASCII_Z 0x5A
|
|
||||||
|
|
||||||
#define ASCII_a 0x61
|
|
||||||
#define ASCII_b 0x62
|
|
||||||
#define ASCII_c 0x63
|
|
||||||
#define ASCII_d 0x64
|
|
||||||
#define ASCII_e 0x65
|
|
||||||
#define ASCII_f 0x66
|
|
||||||
#define ASCII_g 0x67
|
|
||||||
#define ASCII_h 0x68
|
|
||||||
#define ASCII_i 0x69
|
|
||||||
#define ASCII_j 0x6A
|
|
||||||
#define ASCII_k 0x6B
|
|
||||||
#define ASCII_l 0x6C
|
|
||||||
#define ASCII_m 0x6D
|
|
||||||
#define ASCII_n 0x6E
|
|
||||||
#define ASCII_o 0x6F
|
|
||||||
#define ASCII_p 0x70
|
|
||||||
#define ASCII_q 0x71
|
|
||||||
#define ASCII_r 0x72
|
|
||||||
#define ASCII_s 0x73
|
|
||||||
#define ASCII_t 0x74
|
|
||||||
#define ASCII_u 0x75
|
|
||||||
#define ASCII_v 0x76
|
|
||||||
#define ASCII_w 0x77
|
|
||||||
#define ASCII_x 0x78
|
|
||||||
#define ASCII_y 0x79
|
|
||||||
#define ASCII_z 0x7A
|
|
||||||
|
|
||||||
#define ASCII_0 0x30
|
|
||||||
#define ASCII_1 0x31
|
|
||||||
#define ASCII_2 0x32
|
|
||||||
#define ASCII_3 0x33
|
|
||||||
#define ASCII_4 0x34
|
|
||||||
#define ASCII_5 0x35
|
|
||||||
#define ASCII_6 0x36
|
|
||||||
#define ASCII_7 0x37
|
|
||||||
#define ASCII_8 0x38
|
|
||||||
#define ASCII_9 0x39
|
|
||||||
|
|
||||||
#define ASCII_TAB 0x09
|
|
||||||
#define ASCII_SPACE 0x20
|
|
||||||
#define ASCII_EXCL 0x21
|
|
||||||
#define ASCII_QUOT 0x22
|
|
||||||
#define ASCII_AMP 0x26
|
|
||||||
#define ASCII_APOS 0x27
|
|
||||||
#define ASCII_MINUS 0x2D
|
|
||||||
#define ASCII_PERIOD 0x2E
|
|
||||||
#define ASCII_COLON 0x3A
|
|
||||||
#define ASCII_SEMI 0x3B
|
|
||||||
#define ASCII_LT 0x3C
|
|
||||||
#define ASCII_EQUALS 0x3D
|
|
||||||
#define ASCII_GT 0x3E
|
|
||||||
#define ASCII_LSQB 0x5B
|
|
||||||
#define ASCII_RSQB 0x5D
|
|
||||||
#define ASCII_UNDERSCORE 0x5F
|
|
||||||
#define ASCII_LPAREN 0x28
|
|
||||||
#define ASCII_RPAREN 0x29
|
|
||||||
#define ASCII_FF 0x0C
|
|
||||||
#define ASCII_SLASH 0x2F
|
|
||||||
#define ASCII_HASH 0x23
|
|
||||||
#define ASCII_PIPE 0x7C
|
|
||||||
#define ASCII_COMMA 0x2C
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
|
|
||||||
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
|
|
||||||
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
|
|
||||||
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
|
|
||||||
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
|
|
||||||
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
|
||||||
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
|
||||||
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
|
|
||||||
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
|
|
||||||
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
|
||||||
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
|
||||||
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
|
|
||||||
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
|
|
||||||
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
|
||||||
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
|
||||||
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
|
||||||
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
1048
src/expat/expat.h
1048
src/expat/expat.h
File diff suppressed because it is too large
Load Diff
@@ -1,33 +0,0 @@
|
|||||||
/*================================================================
|
|
||||||
** Copyright 2000, Clark Cooper
|
|
||||||
** All rights reserved.
|
|
||||||
**
|
|
||||||
** This is free software. You are permitted to copy, distribute, or modify
|
|
||||||
** it under the terms of the MIT/X license (contained in the COPYING file
|
|
||||||
** with this distribution.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EXPATCONFIG_H
|
|
||||||
#define EXPATCONFIG_H
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define XML_NS 1
|
|
||||||
#define XML_DTD 1
|
|
||||||
#define XML_CONTEXT_BYTES 1024
|
|
||||||
|
|
||||||
/* we will assume all Windows platforms are little endian */
|
|
||||||
#define BYTEORDER 1234
|
|
||||||
|
|
||||||
/* Windows has memmove() available. */
|
|
||||||
#define HAVE_MEMMOVE
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ifndef EXPATCONFIG_H */
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef Expat_External_INCLUDED
|
|
||||||
#define Expat_External_INCLUDED 1
|
|
||||||
|
|
||||||
/* External API definitions */
|
|
||||||
|
|
||||||
#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
|
|
||||||
#define XML_USE_MSC_EXTENSIONS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Expat tries very hard to make the API boundary very specifically
|
|
||||||
defined. There are two macros defined to control this boundary;
|
|
||||||
each of these can be defined before including this header to
|
|
||||||
achieve some different behavior, but doing so it not recommended or
|
|
||||||
tested frequently.
|
|
||||||
|
|
||||||
XMLCALL - The calling convention to use for all calls across the
|
|
||||||
"library boundary." This will default to cdecl, and
|
|
||||||
try really hard to tell the compiler that's what we
|
|
||||||
want.
|
|
||||||
|
|
||||||
XMLIMPORT - Whatever magic is needed to note that a function is
|
|
||||||
to be imported from a dynamically loaded library
|
|
||||||
(.dll, .so, or .sl, depending on your platform).
|
|
||||||
|
|
||||||
The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
|
||||||
expected to be directly useful in client code is XMLCALL.
|
|
||||||
|
|
||||||
Note that on at least some Unix versions, the Expat library must be
|
|
||||||
compiled with the cdecl calling convention as the default since
|
|
||||||
system headers may assume the cdecl convention.
|
|
||||||
*/
|
|
||||||
#ifndef XMLCALL
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define XMLCALL __cdecl
|
|
||||||
#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
|
|
||||||
#define XMLCALL __attribute__((cdecl))
|
|
||||||
#else
|
|
||||||
/* For any platform which uses this definition and supports more than
|
|
||||||
one calling convention, we need to extend this definition to
|
|
||||||
declare the convention used on that platform, if it's possible to
|
|
||||||
do so.
|
|
||||||
|
|
||||||
If this is the case for your platform, please file a bug report
|
|
||||||
with information on how to identify your platform via the C
|
|
||||||
pre-processor and how to specify the same calling convention as the
|
|
||||||
platform's malloc() implementation.
|
|
||||||
*/
|
|
||||||
#define XMLCALL
|
|
||||||
#endif
|
|
||||||
#endif /* not defined XMLCALL */
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(XML_STATIC) && !defined(XMLIMPORT)
|
|
||||||
#ifndef XML_BUILDING_EXPAT
|
|
||||||
/* using Expat from an application */
|
|
||||||
|
|
||||||
#ifdef XML_USE_MSC_EXTENSIONS
|
|
||||||
// #define XMLIMPORT __declspec(dllimport)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif /* not defined XML_STATIC */
|
|
||||||
|
|
||||||
#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
|
|
||||||
#define XMLIMPORT __attribute__ ((visibility ("default")))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If we didn't define it above, define it away: */
|
|
||||||
#ifndef XMLIMPORT
|
|
||||||
#define XMLIMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
|
|
||||||
#define XML_ATTR_MALLOC __attribute__((__malloc__))
|
|
||||||
#else
|
|
||||||
#define XML_ATTR_MALLOC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
|
||||||
#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
|
|
||||||
#else
|
|
||||||
#define XML_ATTR_ALLOC_SIZE(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XML_UNICODE_WCHAR_T
|
|
||||||
#define XML_UNICODE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
|
||||||
#ifdef XML_UNICODE_WCHAR_T
|
|
||||||
typedef wchar_t XML_Char;
|
|
||||||
typedef wchar_t XML_LChar;
|
|
||||||
#else
|
|
||||||
typedef unsigned short XML_Char;
|
|
||||||
typedef char XML_LChar;
|
|
||||||
#endif /* XML_UNICODE_WCHAR_T */
|
|
||||||
#else /* Information is UTF-8 encoded. */
|
|
||||||
typedef char XML_Char;
|
|
||||||
typedef char XML_LChar;
|
|
||||||
#endif /* XML_UNICODE */
|
|
||||||
|
|
||||||
#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
|
||||||
#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
|
|
||||||
typedef __int64 XML_Index;
|
|
||||||
typedef unsigned __int64 XML_Size;
|
|
||||||
#else
|
|
||||||
typedef long long XML_Index;
|
|
||||||
typedef unsigned long long XML_Size;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
typedef long XML_Index;
|
|
||||||
typedef unsigned long XML_Size;
|
|
||||||
#endif /* XML_LARGE_SIZE */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* not Expat_External_INCLUDED */
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
|
|
||||||
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
|
|
||||||
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
|
|
||||||
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
|
|
||||||
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
|
|
||||||
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
|
|
||||||
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
|
||||||
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
|
|
||||||
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
|
|
||||||
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
|
|
||||||
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
|
||||||
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
|
||||||
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
|
|
||||||
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
|
|
||||||
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
|
|
||||||
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
|
|
||||||
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
|
||||||
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/* internal.h
|
|
||||||
|
|
||||||
Internal definitions used by Expat. This is not needed to compile
|
|
||||||
client code.
|
|
||||||
|
|
||||||
The following calling convention macros are defined for frequently
|
|
||||||
called functions:
|
|
||||||
|
|
||||||
FASTCALL - Used for those internal functions that have a simple
|
|
||||||
body and a low number of arguments and local variables.
|
|
||||||
|
|
||||||
PTRCALL - Used for functions called though function pointers.
|
|
||||||
|
|
||||||
PTRFASTCALL - Like PTRCALL, but for low number of arguments.
|
|
||||||
|
|
||||||
inline - Used for selected internal functions for which inlining
|
|
||||||
may improve performance on some platforms.
|
|
||||||
|
|
||||||
Note: Use of these macros is based on judgement, not hard rules,
|
|
||||||
and therefore subject to change.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__)
|
|
||||||
/* We'll use this version by default only where we know it helps.
|
|
||||||
|
|
||||||
regparm() generates warnings on Solaris boxes. See SF bug #692878.
|
|
||||||
|
|
||||||
Instability reported with egcs on a RedHat Linux 7.3.
|
|
||||||
Let's comment out:
|
|
||||||
#define FASTCALL __attribute__((stdcall, regparm(3)))
|
|
||||||
and let's try this:
|
|
||||||
*/
|
|
||||||
#define FASTCALL __attribute__((regparm(3)))
|
|
||||||
#define PTRFASTCALL __attribute__((regparm(3)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Using __fastcall seems to have an unexpected negative effect under
|
|
||||||
MS VC++, especially for function pointers, so we won't use it for
|
|
||||||
now on that platform. It may be reconsidered for a future release
|
|
||||||
if it can be made more effective.
|
|
||||||
Likely reason: __fastcall on Windows is like stdcall, therefore
|
|
||||||
the compiler cannot perform stack optimizations for call clusters.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Make sure all of these are defined if they aren't already. */
|
|
||||||
|
|
||||||
#ifndef FASTCALL
|
|
||||||
#define FASTCALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PTRCALL
|
|
||||||
#define PTRCALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PTRFASTCALL
|
|
||||||
#define PTRFASTCALL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef XML_MIN_SIZE
|
|
||||||
#if !defined(__cplusplus) && !defined(inline)
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define inline __inline
|
|
||||||
#endif /* __GNUC__ */
|
|
||||||
#endif
|
|
||||||
#endif /* XML_MIN_SIZE */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define inline inline
|
|
||||||
#else
|
|
||||||
#ifndef inline
|
|
||||||
#define inline
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef UNUSED_P
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__))
|
|
||||||
# else
|
|
||||||
# define UNUSED_P(p) UNUSED_ ## p
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
align_limit_to_full_utf8_characters(const char * from, const char ** fromLimRef);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
|
|
||||||
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
|
|
||||||
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
|
|
||||||
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
|
|
||||||
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
|
||||||
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
|
|
||||||
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
static const unsigned namingBitmap[] = {
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
|
||||||
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
|
|
||||||
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
|
|
||||||
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
|
|
||||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
|
||||||
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
|
||||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
|
||||||
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
|
||||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
|
||||||
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
|
|
||||||
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
|
|
||||||
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
|
|
||||||
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
|
|
||||||
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
|
|
||||||
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
|
|
||||||
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
|
|
||||||
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
|
|
||||||
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
|
|
||||||
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
|
|
||||||
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
|
|
||||||
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
|
|
||||||
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
|
|
||||||
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
|
|
||||||
0x40000000, 0xF580C900, 0x00000007, 0x02010800,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
|
||||||
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
|
|
||||||
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
|
|
||||||
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
|
|
||||||
0x00000000, 0x00004C40, 0x00000000, 0x00000000,
|
|
||||||
0x00000007, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
|
|
||||||
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
|
|
||||||
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
|
||||||
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
|
|
||||||
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
|
|
||||||
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
|
|
||||||
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
|
|
||||||
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
|
|
||||||
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
|
|
||||||
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
|
|
||||||
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
|
|
||||||
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
|
|
||||||
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
|
|
||||||
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
|
|
||||||
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
|
|
||||||
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
|
|
||||||
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
|
|
||||||
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
|
|
||||||
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
|
|
||||||
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
|
|
||||||
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
|
|
||||||
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
|
|
||||||
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
|
|
||||||
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
|
|
||||||
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
|
|
||||||
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
|
|
||||||
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
|
|
||||||
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
|
|
||||||
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
|
|
||||||
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
|
|
||||||
};
|
|
||||||
static const unsigned char nmstrtPages[] = {
|
|
||||||
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
|
|
||||||
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
|
||||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
|
||||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
};
|
|
||||||
static const unsigned char namePages[] = {
|
|
||||||
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
|
|
||||||
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
|
|
||||||
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
|
|
||||||
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
|
||||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
};
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
|
|
||||||
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
|
|
||||||
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
|
||||||
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
|
||||||
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
|
||||||
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
|
|
||||||
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
|
|
||||||
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
|
|
||||||
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,
|
|
||||||
6458
src/expat/xmlparse.c
6458
src/expat/xmlparse.c
File diff suppressed because it is too large
Load Diff
1322
src/expat/xmlrole.c
1322
src/expat/xmlrole.c
File diff suppressed because it is too large
Load Diff
@@ -1,114 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef XmlRole_INCLUDED
|
|
||||||
#define XmlRole_INCLUDED 1
|
|
||||||
|
|
||||||
#ifdef __VMS
|
|
||||||
/* 0 1 2 3 0 1 2 3
|
|
||||||
1234567890123456789012345678901 1234567890123456789012345678901 */
|
|
||||||
#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "xmltok.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum {
|
|
||||||
XML_ROLE_ERROR = -1,
|
|
||||||
XML_ROLE_NONE = 0,
|
|
||||||
XML_ROLE_XML_DECL,
|
|
||||||
XML_ROLE_INSTANCE_START,
|
|
||||||
XML_ROLE_DOCTYPE_NONE,
|
|
||||||
XML_ROLE_DOCTYPE_NAME,
|
|
||||||
XML_ROLE_DOCTYPE_SYSTEM_ID,
|
|
||||||
XML_ROLE_DOCTYPE_PUBLIC_ID,
|
|
||||||
XML_ROLE_DOCTYPE_INTERNAL_SUBSET,
|
|
||||||
XML_ROLE_DOCTYPE_CLOSE,
|
|
||||||
XML_ROLE_GENERAL_ENTITY_NAME,
|
|
||||||
XML_ROLE_PARAM_ENTITY_NAME,
|
|
||||||
XML_ROLE_ENTITY_NONE,
|
|
||||||
XML_ROLE_ENTITY_VALUE,
|
|
||||||
XML_ROLE_ENTITY_SYSTEM_ID,
|
|
||||||
XML_ROLE_ENTITY_PUBLIC_ID,
|
|
||||||
XML_ROLE_ENTITY_COMPLETE,
|
|
||||||
XML_ROLE_ENTITY_NOTATION_NAME,
|
|
||||||
XML_ROLE_NOTATION_NONE,
|
|
||||||
XML_ROLE_NOTATION_NAME,
|
|
||||||
XML_ROLE_NOTATION_SYSTEM_ID,
|
|
||||||
XML_ROLE_NOTATION_NO_SYSTEM_ID,
|
|
||||||
XML_ROLE_NOTATION_PUBLIC_ID,
|
|
||||||
XML_ROLE_ATTRIBUTE_NAME,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_CDATA,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_ID,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_IDREF,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
|
|
||||||
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
|
|
||||||
XML_ROLE_ATTRIBUTE_ENUM_VALUE,
|
|
||||||
XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
|
|
||||||
XML_ROLE_ATTLIST_NONE,
|
|
||||||
XML_ROLE_ATTLIST_ELEMENT_NAME,
|
|
||||||
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
|
|
||||||
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
|
|
||||||
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
|
|
||||||
XML_ROLE_FIXED_ATTRIBUTE_VALUE,
|
|
||||||
XML_ROLE_ELEMENT_NONE,
|
|
||||||
XML_ROLE_ELEMENT_NAME,
|
|
||||||
XML_ROLE_CONTENT_ANY,
|
|
||||||
XML_ROLE_CONTENT_EMPTY,
|
|
||||||
XML_ROLE_CONTENT_PCDATA,
|
|
||||||
XML_ROLE_GROUP_OPEN,
|
|
||||||
XML_ROLE_GROUP_CLOSE,
|
|
||||||
XML_ROLE_GROUP_CLOSE_REP,
|
|
||||||
XML_ROLE_GROUP_CLOSE_OPT,
|
|
||||||
XML_ROLE_GROUP_CLOSE_PLUS,
|
|
||||||
XML_ROLE_GROUP_CHOICE,
|
|
||||||
XML_ROLE_GROUP_SEQUENCE,
|
|
||||||
XML_ROLE_CONTENT_ELEMENT,
|
|
||||||
XML_ROLE_CONTENT_ELEMENT_REP,
|
|
||||||
XML_ROLE_CONTENT_ELEMENT_OPT,
|
|
||||||
XML_ROLE_CONTENT_ELEMENT_PLUS,
|
|
||||||
XML_ROLE_PI,
|
|
||||||
XML_ROLE_COMMENT,
|
|
||||||
#ifdef XML_DTD
|
|
||||||
XML_ROLE_TEXT_DECL,
|
|
||||||
XML_ROLE_IGNORE_SECT,
|
|
||||||
XML_ROLE_INNER_PARAM_ENTITY_REF,
|
|
||||||
#endif /* XML_DTD */
|
|
||||||
XML_ROLE_PARAM_ENTITY_REF
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct prolog_state {
|
|
||||||
int (PTRCALL *handler) (struct prolog_state *state,
|
|
||||||
int tok,
|
|
||||||
const char *ptr,
|
|
||||||
const char *end,
|
|
||||||
const ENCODING *enc);
|
|
||||||
unsigned level;
|
|
||||||
int role_none;
|
|
||||||
#ifdef XML_DTD
|
|
||||||
unsigned includeLevel;
|
|
||||||
int documentEntity;
|
|
||||||
int inEntityValue;
|
|
||||||
#endif /* XML_DTD */
|
|
||||||
} PROLOG_STATE;
|
|
||||||
|
|
||||||
void XmlPrologStateInit(PROLOG_STATE *);
|
|
||||||
#ifdef XML_DTD
|
|
||||||
void XmlPrologStateInitExternalEntity(PROLOG_STATE *);
|
|
||||||
#endif /* XML_DTD */
|
|
||||||
|
|
||||||
#define XmlTokenRole(state, tok, ptr, end, enc) \
|
|
||||||
(((state)->handler)(state, tok, ptr, end, enc))
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* not XmlRole_INCLUDED */
|
|
||||||
1737
src/expat/xmltok.c
1737
src/expat/xmltok.c
File diff suppressed because it is too large
Load Diff
@@ -1,322 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef XmlTok_INCLUDED
|
|
||||||
#define XmlTok_INCLUDED 1
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following token may be returned by XmlContentTok */
|
|
||||||
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be
|
|
||||||
start of illegal ]]> sequence */
|
|
||||||
/* The following tokens may be returned by both XmlPrologTok and
|
|
||||||
XmlContentTok.
|
|
||||||
*/
|
|
||||||
#define XML_TOK_NONE -4 /* The string to be scanned is empty */
|
|
||||||
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
|
|
||||||
might be part of CRLF sequence */
|
|
||||||
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
|
|
||||||
#define XML_TOK_PARTIAL -1 /* only part of a token */
|
|
||||||
#define XML_TOK_INVALID 0
|
|
||||||
|
|
||||||
/* The following tokens are returned by XmlContentTok; some are also
|
|
||||||
returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok.
|
|
||||||
*/
|
|
||||||
#define XML_TOK_START_TAG_WITH_ATTS 1
|
|
||||||
#define XML_TOK_START_TAG_NO_ATTS 2
|
|
||||||
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
|
|
||||||
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
|
|
||||||
#define XML_TOK_END_TAG 5
|
|
||||||
#define XML_TOK_DATA_CHARS 6
|
|
||||||
#define XML_TOK_DATA_NEWLINE 7
|
|
||||||
#define XML_TOK_CDATA_SECT_OPEN 8
|
|
||||||
#define XML_TOK_ENTITY_REF 9
|
|
||||||
#define XML_TOK_CHAR_REF 10 /* numeric character reference */
|
|
||||||
|
|
||||||
/* The following tokens may be returned by both XmlPrologTok and
|
|
||||||
XmlContentTok.
|
|
||||||
*/
|
|
||||||
#define XML_TOK_PI 11 /* processing instruction */
|
|
||||||
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
|
|
||||||
#define XML_TOK_COMMENT 13
|
|
||||||
#define XML_TOK_BOM 14 /* Byte order mark */
|
|
||||||
|
|
||||||
/* The following tokens are returned only by XmlPrologTok */
|
|
||||||
#define XML_TOK_PROLOG_S 15
|
|
||||||
#define XML_TOK_DECL_OPEN 16 /* <!foo */
|
|
||||||
#define XML_TOK_DECL_CLOSE 17 /* > */
|
|
||||||
#define XML_TOK_NAME 18
|
|
||||||
#define XML_TOK_NMTOKEN 19
|
|
||||||
#define XML_TOK_POUND_NAME 20 /* #name */
|
|
||||||
#define XML_TOK_OR 21 /* | */
|
|
||||||
#define XML_TOK_PERCENT 22
|
|
||||||
#define XML_TOK_OPEN_PAREN 23
|
|
||||||
#define XML_TOK_CLOSE_PAREN 24
|
|
||||||
#define XML_TOK_OPEN_BRACKET 25
|
|
||||||
#define XML_TOK_CLOSE_BRACKET 26
|
|
||||||
#define XML_TOK_LITERAL 27
|
|
||||||
#define XML_TOK_PARAM_ENTITY_REF 28
|
|
||||||
#define XML_TOK_INSTANCE_START 29
|
|
||||||
|
|
||||||
/* The following occur only in element type declarations */
|
|
||||||
#define XML_TOK_NAME_QUESTION 30 /* name? */
|
|
||||||
#define XML_TOK_NAME_ASTERISK 31 /* name* */
|
|
||||||
#define XML_TOK_NAME_PLUS 32 /* name+ */
|
|
||||||
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
|
|
||||||
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
|
|
||||||
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
|
|
||||||
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
|
|
||||||
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
|
|
||||||
#define XML_TOK_COMMA 38
|
|
||||||
|
|
||||||
/* The following token is returned only by XmlAttributeValueTok */
|
|
||||||
#define XML_TOK_ATTRIBUTE_VALUE_S 39
|
|
||||||
|
|
||||||
/* The following token is returned only by XmlCdataSectionTok */
|
|
||||||
#define XML_TOK_CDATA_SECT_CLOSE 40
|
|
||||||
|
|
||||||
/* With namespace processing this is returned by XmlPrologTok for a
|
|
||||||
name with a colon.
|
|
||||||
*/
|
|
||||||
#define XML_TOK_PREFIXED_NAME 41
|
|
||||||
|
|
||||||
#ifdef XML_DTD
|
|
||||||
#define XML_TOK_IGNORE_SECT 42
|
|
||||||
#endif /* XML_DTD */
|
|
||||||
|
|
||||||
#ifdef XML_DTD
|
|
||||||
#define XML_N_STATES 4
|
|
||||||
#else /* not XML_DTD */
|
|
||||||
#define XML_N_STATES 3
|
|
||||||
#endif /* not XML_DTD */
|
|
||||||
|
|
||||||
#define XML_PROLOG_STATE 0
|
|
||||||
#define XML_CONTENT_STATE 1
|
|
||||||
#define XML_CDATA_SECTION_STATE 2
|
|
||||||
#ifdef XML_DTD
|
|
||||||
#define XML_IGNORE_SECTION_STATE 3
|
|
||||||
#endif /* XML_DTD */
|
|
||||||
|
|
||||||
#define XML_N_LITERAL_TYPES 2
|
|
||||||
#define XML_ATTRIBUTE_VALUE_LITERAL 0
|
|
||||||
#define XML_ENTITY_VALUE_LITERAL 1
|
|
||||||
|
|
||||||
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
|
|
||||||
#define XML_UTF8_ENCODE_MAX 4
|
|
||||||
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
|
|
||||||
#define XML_UTF16_ENCODE_MAX 2
|
|
||||||
|
|
||||||
typedef struct position {
|
|
||||||
/* first line and first column are 0 not 1 */
|
|
||||||
XML_Size lineNumber;
|
|
||||||
XML_Size columnNumber;
|
|
||||||
} POSITION;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char *name;
|
|
||||||
const char *valuePtr;
|
|
||||||
const char *valueEnd;
|
|
||||||
char normalized;
|
|
||||||
} ATTRIBUTE;
|
|
||||||
|
|
||||||
struct encoding;
|
|
||||||
typedef struct encoding ENCODING;
|
|
||||||
|
|
||||||
typedef int (PTRCALL *SCANNER)(const ENCODING *,
|
|
||||||
const char *,
|
|
||||||
const char *,
|
|
||||||
const char **);
|
|
||||||
|
|
||||||
enum XML_Convert_Result {
|
|
||||||
XML_CONVERT_COMPLETED = 0,
|
|
||||||
XML_CONVERT_INPUT_INCOMPLETE = 1,
|
|
||||||
XML_CONVERT_OUTPUT_EXHAUSTED = 2 /* and therefore potentially input remaining as well */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct encoding {
|
|
||||||
SCANNER scanners[XML_N_STATES];
|
|
||||||
SCANNER literalScanners[XML_N_LITERAL_TYPES];
|
|
||||||
int (PTRCALL *sameName)(const ENCODING *,
|
|
||||||
const char *,
|
|
||||||
const char *);
|
|
||||||
int (PTRCALL *nameMatchesAscii)(const ENCODING *,
|
|
||||||
const char *,
|
|
||||||
const char *,
|
|
||||||
const char *);
|
|
||||||
int (PTRFASTCALL *nameLength)(const ENCODING *, const char *);
|
|
||||||
const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);
|
|
||||||
int (PTRCALL *getAtts)(const ENCODING *enc,
|
|
||||||
const char *ptr,
|
|
||||||
int attsMax,
|
|
||||||
ATTRIBUTE *atts);
|
|
||||||
int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
|
|
||||||
int (PTRCALL *predefinedEntityName)(const ENCODING *,
|
|
||||||
const char *,
|
|
||||||
const char *);
|
|
||||||
void (PTRCALL *updatePosition)(const ENCODING *,
|
|
||||||
const char *ptr,
|
|
||||||
const char *end,
|
|
||||||
POSITION *);
|
|
||||||
int (PTRCALL *isPublicId)(const ENCODING *enc,
|
|
||||||
const char *ptr,
|
|
||||||
const char *end,
|
|
||||||
const char **badPtr);
|
|
||||||
enum XML_Convert_Result (PTRCALL *utf8Convert)(const ENCODING *enc,
|
|
||||||
const char **fromP,
|
|
||||||
const char *fromLim,
|
|
||||||
char **toP,
|
|
||||||
const char *toLim);
|
|
||||||
enum XML_Convert_Result (PTRCALL *utf16Convert)(const ENCODING *enc,
|
|
||||||
const char **fromP,
|
|
||||||
const char *fromLim,
|
|
||||||
unsigned short **toP,
|
|
||||||
const unsigned short *toLim);
|
|
||||||
int minBytesPerChar;
|
|
||||||
char isUtf8;
|
|
||||||
char isUtf16;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Scan the string starting at ptr until the end of the next complete
|
|
||||||
token, but do not scan past eptr. Return an integer giving the
|
|
||||||
type of token.
|
|
||||||
|
|
||||||
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
|
|
||||||
|
|
||||||
Return XML_TOK_PARTIAL when the string does not contain a complete
|
|
||||||
token; nextTokPtr will not be set.
|
|
||||||
|
|
||||||
Return XML_TOK_INVALID when the string does not start a valid
|
|
||||||
token; nextTokPtr will be set to point to the character which made
|
|
||||||
the token invalid.
|
|
||||||
|
|
||||||
Otherwise the string starts with a valid token; nextTokPtr will be
|
|
||||||
set to point to the character following the end of that token.
|
|
||||||
|
|
||||||
Each data character counts as a single token, but adjacent data
|
|
||||||
characters may be returned together. Similarly for characters in
|
|
||||||
the prolog outside literals, comments and processing instructions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
|
|
||||||
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
|
|
||||||
|
|
||||||
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
|
|
||||||
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
|
|
||||||
|
|
||||||
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
|
|
||||||
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
|
|
||||||
|
|
||||||
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
|
|
||||||
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
|
|
||||||
|
|
||||||
#ifdef XML_DTD
|
|
||||||
|
|
||||||
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
|
|
||||||
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
|
|
||||||
|
|
||||||
#endif /* XML_DTD */
|
|
||||||
|
|
||||||
/* This is used for performing a 2nd-level tokenization on the content
|
|
||||||
of a literal that has already been returned by XmlTok.
|
|
||||||
*/
|
|
||||||
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
|
|
||||||
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
|
|
||||||
|
|
||||||
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
|
|
||||||
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
|
|
||||||
|
|
||||||
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
|
|
||||||
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
|
|
||||||
|
|
||||||
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
|
|
||||||
|
|
||||||
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
|
|
||||||
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
|
|
||||||
|
|
||||||
#define XmlNameLength(enc, ptr) \
|
|
||||||
(((enc)->nameLength)(enc, ptr))
|
|
||||||
|
|
||||||
#define XmlSkipS(enc, ptr) \
|
|
||||||
(((enc)->skipS)(enc, ptr))
|
|
||||||
|
|
||||||
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
|
|
||||||
(((enc)->getAtts)(enc, ptr, attsMax, atts))
|
|
||||||
|
|
||||||
#define XmlCharRefNumber(enc, ptr) \
|
|
||||||
(((enc)->charRefNumber)(enc, ptr))
|
|
||||||
|
|
||||||
#define XmlPredefinedEntityName(enc, ptr, end) \
|
|
||||||
(((enc)->predefinedEntityName)(enc, ptr, end))
|
|
||||||
|
|
||||||
#define XmlUpdatePosition(enc, ptr, end, pos) \
|
|
||||||
(((enc)->updatePosition)(enc, ptr, end, pos))
|
|
||||||
|
|
||||||
#define XmlIsPublicId(enc, ptr, end, badPtr) \
|
|
||||||
(((enc)->isPublicId)(enc, ptr, end, badPtr))
|
|
||||||
|
|
||||||
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
|
|
||||||
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
|
|
||||||
|
|
||||||
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
|
|
||||||
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
ENCODING initEnc;
|
|
||||||
const ENCODING **encPtr;
|
|
||||||
} INIT_ENCODING;
|
|
||||||
|
|
||||||
int XmlParseXmlDecl(int isGeneralTextEntity,
|
|
||||||
const ENCODING *enc,
|
|
||||||
const char *ptr,
|
|
||||||
const char *end,
|
|
||||||
const char **badPtr,
|
|
||||||
const char **versionPtr,
|
|
||||||
const char **versionEndPtr,
|
|
||||||
const char **encodingNamePtr,
|
|
||||||
const ENCODING **namedEncodingPtr,
|
|
||||||
int *standalonePtr);
|
|
||||||
|
|
||||||
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
|
|
||||||
const ENCODING *XmlGetUtf8InternalEncoding(void);
|
|
||||||
const ENCODING *XmlGetUtf16InternalEncoding(void);
|
|
||||||
int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
|
|
||||||
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
|
|
||||||
int XmlSizeOfUnknownEncoding(void);
|
|
||||||
|
|
||||||
|
|
||||||
typedef int (XMLCALL *CONVERTER) (void *userData, const char *p);
|
|
||||||
|
|
||||||
ENCODING *
|
|
||||||
XmlInitUnknownEncoding(void *mem,
|
|
||||||
int *table,
|
|
||||||
CONVERTER convert,
|
|
||||||
void *userData);
|
|
||||||
|
|
||||||
int XmlParseXmlDeclNS(int isGeneralTextEntity,
|
|
||||||
const ENCODING *enc,
|
|
||||||
const char *ptr,
|
|
||||||
const char *end,
|
|
||||||
const char **badPtr,
|
|
||||||
const char **versionPtr,
|
|
||||||
const char **versionEndPtr,
|
|
||||||
const char **encodingNamePtr,
|
|
||||||
const ENCODING **namedEncodingPtr,
|
|
||||||
int *standalonePtr);
|
|
||||||
|
|
||||||
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
|
|
||||||
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
|
|
||||||
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
|
|
||||||
ENCODING *
|
|
||||||
XmlInitUnknownEncodingNS(void *mem,
|
|
||||||
int *table,
|
|
||||||
CONVERTER convert,
|
|
||||||
void *userData);
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* not XmlTok_INCLUDED */
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum {
|
|
||||||
BT_NONXML,
|
|
||||||
BT_MALFORM,
|
|
||||||
BT_LT,
|
|
||||||
BT_AMP,
|
|
||||||
BT_RSQB,
|
|
||||||
BT_LEAD2,
|
|
||||||
BT_LEAD3,
|
|
||||||
BT_LEAD4,
|
|
||||||
BT_TRAIL,
|
|
||||||
BT_CR,
|
|
||||||
BT_LF,
|
|
||||||
BT_GT,
|
|
||||||
BT_QUOT,
|
|
||||||
BT_APOS,
|
|
||||||
BT_EQUALS,
|
|
||||||
BT_QUEST,
|
|
||||||
BT_EXCL,
|
|
||||||
BT_SOL,
|
|
||||||
BT_SEMI,
|
|
||||||
BT_NUM,
|
|
||||||
BT_LSQB,
|
|
||||||
BT_S,
|
|
||||||
BT_NMSTRT,
|
|
||||||
BT_COLON,
|
|
||||||
BT_HEX,
|
|
||||||
BT_DIGIT,
|
|
||||||
BT_NAME,
|
|
||||||
BT_MINUS,
|
|
||||||
BT_OTHER, /* known not to be a name or name start character */
|
|
||||||
BT_NONASCII, /* might be a name or name start character */
|
|
||||||
BT_PERCNT,
|
|
||||||
BT_LPAR,
|
|
||||||
BT_RPAR,
|
|
||||||
BT_AST,
|
|
||||||
BT_PLUS,
|
|
||||||
BT_COMMA,
|
|
||||||
BT_VERBAR
|
|
||||||
};
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,115 +0,0 @@
|
|||||||
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|
||||||
See the file COPYING for copying permission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file is included! */
|
|
||||||
#ifdef XML_TOK_NS_C
|
|
||||||
|
|
||||||
const ENCODING *
|
|
||||||
NS(XmlGetUtf8InternalEncoding)(void)
|
|
||||||
{
|
|
||||||
return &ns(internal_utf8_encoding).enc;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ENCODING *
|
|
||||||
NS(XmlGetUtf16InternalEncoding)(void)
|
|
||||||
{
|
|
||||||
#if BYTEORDER == 1234
|
|
||||||
return &ns(internal_little2_encoding).enc;
|
|
||||||
#elif BYTEORDER == 4321
|
|
||||||
return &ns(internal_big2_encoding).enc;
|
|
||||||
#else
|
|
||||||
const short n = 1;
|
|
||||||
return (*(const char *)&n
|
|
||||||
? &ns(internal_little2_encoding).enc
|
|
||||||
: &ns(internal_big2_encoding).enc);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static const ENCODING * const NS(encodings)[] = {
|
|
||||||
&ns(latin1_encoding).enc,
|
|
||||||
&ns(ascii_encoding).enc,
|
|
||||||
&ns(utf8_encoding).enc,
|
|
||||||
&ns(big2_encoding).enc,
|
|
||||||
&ns(big2_encoding).enc,
|
|
||||||
&ns(little2_encoding).enc,
|
|
||||||
&ns(utf8_encoding).enc /* NO_ENC */
|
|
||||||
};
|
|
||||||
|
|
||||||
static int PTRCALL
|
|
||||||
NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
|
|
||||||
const char **nextTokPtr)
|
|
||||||
{
|
|
||||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc,
|
|
||||||
XML_PROLOG_STATE, ptr, end, nextTokPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int PTRCALL
|
|
||||||
NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
|
|
||||||
const char **nextTokPtr)
|
|
||||||
{
|
|
||||||
return initScan(NS(encodings), (const INIT_ENCODING *)enc,
|
|
||||||
XML_CONTENT_STATE, ptr, end, nextTokPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr,
|
|
||||||
const char *name)
|
|
||||||
{
|
|
||||||
int i = getEncodingIndex(name);
|
|
||||||
if (i == UNKNOWN_ENC)
|
|
||||||
return 0;
|
|
||||||
SET_INIT_ENC_INDEX(p, i);
|
|
||||||
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
|
|
||||||
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
|
|
||||||
p->initEnc.updatePosition = initUpdatePosition;
|
|
||||||
p->encPtr = encPtr;
|
|
||||||
*encPtr = &(p->initEnc);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const ENCODING *
|
|
||||||
NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
|
|
||||||
{
|
|
||||||
#define ENCODING_MAX 128
|
|
||||||
char buf[ENCODING_MAX];
|
|
||||||
char *p = buf;
|
|
||||||
int i;
|
|
||||||
XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
|
|
||||||
if (ptr != end)
|
|
||||||
return 0;
|
|
||||||
*p = 0;
|
|
||||||
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
|
|
||||||
return enc;
|
|
||||||
i = getEncodingIndex(buf);
|
|
||||||
if (i == UNKNOWN_ENC)
|
|
||||||
return 0;
|
|
||||||
return NS(encodings)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
NS(XmlParseXmlDecl)(int isGeneralTextEntity,
|
|
||||||
const ENCODING *enc,
|
|
||||||
const char *ptr,
|
|
||||||
const char *end,
|
|
||||||
const char **badPtr,
|
|
||||||
const char **versionPtr,
|
|
||||||
const char **versionEndPtr,
|
|
||||||
const char **encodingName,
|
|
||||||
const ENCODING **encoding,
|
|
||||||
int *standalone)
|
|
||||||
{
|
|
||||||
return doParseXmlDecl(NS(findEncoding),
|
|
||||||
isGeneralTextEntity,
|
|
||||||
enc,
|
|
||||||
ptr,
|
|
||||||
end,
|
|
||||||
badPtr,
|
|
||||||
versionPtr,
|
|
||||||
versionEndPtr,
|
|
||||||
encodingName,
|
|
||||||
encoding,
|
|
||||||
standalone);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* XML_TOK_NS_C */
|
|
||||||
@@ -13,6 +13,8 @@ add_library(imgui STATIC
|
|||||||
imgui_demo.cpp
|
imgui_demo.cpp
|
||||||
imgui_draw.cpp
|
imgui_draw.cpp
|
||||||
imgui_widgets.cpp
|
imgui_widgets.cpp
|
||||||
|
imgui_stdlib.cpp
|
||||||
|
imgui_stdlib.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
|
|||||||
@@ -10970,7 +10970,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
|
|
||||||
// Basic info
|
// Basic info
|
||||||
Text("Dear ImGui %s", GetVersion());
|
Text("Dear ImGui %s", GetVersion());
|
||||||
Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
//Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
||||||
Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
|
Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
|
||||||
Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows);
|
Text("%d active windows (%d visible)", io.MetricsActiveWindows, io.MetricsRenderWindows);
|
||||||
Text("%d active allocations", io.MetricsActiveAllocations);
|
Text("%d active allocations", io.MetricsActiveAllocations);
|
||||||
|
|||||||
76
src/imgui/imgui_stdlib.cpp
Normal file
76
src/imgui/imgui_stdlib.cpp
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||||
|
// This is also an example of how you may wrap your own similar types.
|
||||||
|
|
||||||
|
// Compatibility:
|
||||||
|
// - std::string support is only guaranteed to work from C++11.
|
||||||
|
// If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture)
|
||||||
|
|
||||||
|
// Changelog:
|
||||||
|
// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_stdlib.h"
|
||||||
|
|
||||||
|
struct InputTextCallback_UserData
|
||||||
|
{
|
||||||
|
std::string* Str;
|
||||||
|
ImGuiInputTextCallback ChainCallback;
|
||||||
|
void* ChainCallbackUserData;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int InputTextCallback(ImGuiInputTextCallbackData* data)
|
||||||
|
{
|
||||||
|
InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
|
||||||
|
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
||||||
|
{
|
||||||
|
// Resize string callback
|
||||||
|
// If for some reason we refuse the new length (BufTextLen) and/or capacity (BufSize) we need to set them back to what we want.
|
||||||
|
std::string* str = user_data->Str;
|
||||||
|
IM_ASSERT(data->Buf == str->c_str());
|
||||||
|
str->resize(data->BufTextLen);
|
||||||
|
data->Buf = (char*)str->c_str();
|
||||||
|
}
|
||||||
|
else if (user_data->ChainCallback)
|
||||||
|
{
|
||||||
|
// Forward to user callback, if any
|
||||||
|
data->UserData = user_data->ChainCallbackUserData;
|
||||||
|
return user_data->ChainCallback(data);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||||
|
{
|
||||||
|
IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
|
||||||
|
flags |= ImGuiInputTextFlags_CallbackResize;
|
||||||
|
|
||||||
|
InputTextCallback_UserData cb_user_data;
|
||||||
|
cb_user_data.Str = str;
|
||||||
|
cb_user_data.ChainCallback = callback;
|
||||||
|
cb_user_data.ChainCallbackUserData = user_data;
|
||||||
|
return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||||
|
{
|
||||||
|
IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
|
||||||
|
flags |= ImGuiInputTextFlags_CallbackResize;
|
||||||
|
|
||||||
|
InputTextCallback_UserData cb_user_data;
|
||||||
|
cb_user_data.Str = str;
|
||||||
|
cb_user_data.ChainCallback = callback;
|
||||||
|
cb_user_data.ChainCallbackUserData = user_data;
|
||||||
|
return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui::InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data)
|
||||||
|
{
|
||||||
|
IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0);
|
||||||
|
flags |= ImGuiInputTextFlags_CallbackResize;
|
||||||
|
|
||||||
|
InputTextCallback_UserData cb_user_data;
|
||||||
|
cb_user_data.Str = str;
|
||||||
|
cb_user_data.ChainCallback = callback;
|
||||||
|
cb_user_data.ChainCallbackUserData = user_data;
|
||||||
|
return InputTextWithHint(label, hint, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data);
|
||||||
|
}
|
||||||
22
src/imgui/imgui_stdlib.h
Normal file
22
src/imgui/imgui_stdlib.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// dear imgui: wrappers for C++ standard library (STL) types (std::string, etc.)
|
||||||
|
// This is also an example of how you may wrap your own similar types.
|
||||||
|
|
||||||
|
// Compatibility:
|
||||||
|
// - std::string support is only guaranteed to work from C++11.
|
||||||
|
// If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture)
|
||||||
|
|
||||||
|
// Changelog:
|
||||||
|
// - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace ImGui
|
||||||
|
{
|
||||||
|
// ImGui::InputText() with std::string
|
||||||
|
// Because text input needs dynamic resizing, we need to setup a callback to grow the capacity
|
||||||
|
IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
|
IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
|
IMGUI_API bool InputTextWithHint(const char* label, const char* hint, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
|
}
|
||||||
@@ -4815,8 +4815,9 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
PushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);
|
||||||
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
PushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);
|
||||||
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
PushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);
|
||||||
|
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0)); // Ensure no clip rect so mouse hover can reach FramePadding edges
|
||||||
bool child_visible = BeginChildEx(label, id, frame_bb.GetSize(), true, ImGuiWindowFlags_NoMove);
|
bool child_visible = BeginChildEx(label, id, frame_bb.GetSize(), true, ImGuiWindowFlags_NoMove);
|
||||||
PopStyleVar(2);
|
PopStyleVar(3);
|
||||||
PopStyleColor();
|
PopStyleColor();
|
||||||
if (!child_visible)
|
if (!child_visible)
|
||||||
{
|
{
|
||||||
@@ -5454,7 +5455,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
// Test if cursor is vertically visible
|
// Test if cursor is vertically visible
|
||||||
if (cursor_offset.y - g.FontSize < scroll_y)
|
if (cursor_offset.y - g.FontSize < scroll_y)
|
||||||
scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
|
scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
|
||||||
else if (cursor_offset.y - inner_size.y >= scroll_y)
|
else if (cursor_offset.y - (inner_size.y - style.FramePadding.y * 2.0f) >= scroll_y)
|
||||||
scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;
|
scroll_y = cursor_offset.y - inner_size.y + style.FramePadding.y * 2.0f;
|
||||||
const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);
|
const float scroll_max_y = ImMax((text_size.y + style.FramePadding.y * 2.0f) - inner_size.y, 0.0f);
|
||||||
scroll_y = ImClamp(scroll_y, 0.0f, scroll_max_y);
|
scroll_y = ImClamp(scroll_y, 0.0f, scroll_max_y);
|
||||||
|
|||||||
@@ -500,11 +500,11 @@ int main(int arg, char **argv)
|
|||||||
#ifndef __STB_INCLUDE_STB_TRUETYPE_H__
|
#ifndef __STB_INCLUDE_STB_TRUETYPE_H__
|
||||||
#define __STB_INCLUDE_STB_TRUETYPE_H__
|
#define __STB_INCLUDE_STB_TRUETYPE_H__
|
||||||
|
|
||||||
//#ifdef STBTT_STATIC
|
#ifdef STBTT_STATIC
|
||||||
//#define STBTT_DEF static
|
#define STBTT_DEF static
|
||||||
//#else
|
#else
|
||||||
#define STBTT_DEF extern
|
#define STBTT_DEF extern
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -1053,7 +1053,7 @@ inline S convexHull(const S& sh, const PathTag&)
|
|||||||
namespace sl = shapelike;
|
namespace sl = shapelike;
|
||||||
|
|
||||||
size_t edges = sl::cend(sh) - sl::cbegin(sh);
|
size_t edges = sl::cend(sh) - sl::cbegin(sh);
|
||||||
if(edges <= 3) return {};
|
if(edges < 3) return {};
|
||||||
|
|
||||||
bool closed = false;
|
bool closed = false;
|
||||||
std::vector<Point> U, L;
|
std::vector<Point> U, L;
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ struct NfpPConfig {
|
|||||||
*/
|
*/
|
||||||
bool parallel = true;
|
bool parallel = true;
|
||||||
|
|
||||||
|
bool save_svg = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief before_packing Callback that is called just before a search for
|
* @brief before_packing Callback that is called just before a search for
|
||||||
* a new item's position is started. You can use this to create various
|
* a new item's position is started. You can use this to create various
|
||||||
@@ -987,38 +989,39 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SVGTOOLS_HPP
|
#ifdef SVGTOOLS_HPP
|
||||||
svg::SVGWriter<RawShape> svgwriter;
|
if (config_.save_svg) {
|
||||||
Box binbb2(binbb.width() * 2, binbb.height() * 2, binbb.center()); // expand bbox to allow object be drawed outside
|
svg::SVGWriter<RawShape> svgwriter;
|
||||||
svgwriter.setSize(binbb2);
|
Box binbb2(binbb.width() * 2, binbb.height() * 2, binbb.center()); // expand bbox to allow object be drawed outside
|
||||||
svgwriter.conf_.x0 = binbb.width();
|
svgwriter.setSize(binbb2);
|
||||||
svgwriter.conf_.y0 = -binbb.height()/2; // origin is top left corner
|
svgwriter.conf_.x0 = binbb.width();
|
||||||
svgwriter.add_comment("bed");
|
svgwriter.conf_.y0 = -binbb.height() / 2; // origin is top left corner
|
||||||
svgwriter.writeShape(box2RawShape(binbb), "none", "black");
|
svgwriter.add_comment("bed");
|
||||||
svgwriter.add_comment("nfps");
|
svgwriter.writeShape(box2RawShape(binbb), "none", "black");
|
||||||
for (int i = 0; i < nfps.size(); i++)
|
svgwriter.add_comment("nfps");
|
||||||
svgwriter.writeShape(nfps[i], "none", "blue");
|
for (int i = 0; i < nfps.size(); i++) svgwriter.writeShape(nfps[i], "none", "blue");
|
||||||
for (int i = 0; i < items_.size(); i++) {
|
for (int i = 0; i < items_.size(); i++) {
|
||||||
svgwriter.add_comment(items_[i].get().name);
|
svgwriter.add_comment(items_[i].get().name);
|
||||||
svgwriter.writeItem(items_[i], "none", "black");
|
svgwriter.writeItem(items_[i], "none", "black");
|
||||||
}
|
}
|
||||||
svgwriter.add_comment("merged_pile_");
|
svgwriter.add_comment("merged_pile_");
|
||||||
for (int i = 0; i < merged_pile_.size(); i++)
|
for (int i = 0; i < merged_pile_.size(); i++) svgwriter.writeShape(merged_pile_[i], "none", "yellow");
|
||||||
svgwriter.writeShape(merged_pile_[i], "none", "yellow");
|
svgwriter.add_comment("current item");
|
||||||
svgwriter.add_comment("current item");
|
svgwriter.writeItem(item, "red", "red", 2);
|
||||||
svgwriter.writeItem(item, "red", "red", 2);
|
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss.setf(std::ios::fixed | std::ios::showpoint);
|
ss.setf(std::ios::fixed | std::ios::showpoint);
|
||||||
ss.precision(1);
|
ss.precision(1);
|
||||||
ss << "t=" << round(item.translation().x() / 1e6) << "," << round(item.translation().y() / 1e6)
|
ss << "t=" << round(item.translation().x() / 1e6) << ","
|
||||||
//<< "-rot=" << round(item.rotation().toDegrees())
|
<< round(item.translation().y() / 1e6)
|
||||||
<< "-sco=" << round(global_score);
|
//<< "-rot=" << round(item.rotation().toDegrees())
|
||||||
svgwriter.draw_text(20, 20, ss.str(), "blue", 20);
|
<< "-sco=" << round(global_score);
|
||||||
ss.str("");
|
svgwriter.draw_text(20, 20, ss.str(), "blue", 20);
|
||||||
ss << "items.size=" << items_.size()
|
ss.str("");
|
||||||
<< "-merged_pile.size=" << merged_pile_.size();
|
ss << "items.size=" << items_.size() << "-merged_pile.size=" << merged_pile_.size();
|
||||||
svgwriter.draw_text(20, 40, ss.str(), "blue", 20);
|
svgwriter.draw_text(20, 40, ss.str(), "blue", 20);
|
||||||
svgwriter.save(boost::filesystem::path("C:/Users/arthur.tang/AppData/Roaming/QIDIStudioInternal/SVG")/ ("nfpplacer_" + std::to_string(plate_id) + "_" + ss.str() + "_" + item.name + ".svg"));
|
svgwriter.save(boost::filesystem::path("C:/Users/arthur.tang/AppData/Roaming/QIDIStudioInternal/SVG") /
|
||||||
|
("nfpplacer_" + std::to_string(plate_id) + "_" + ss.str() + "_" + item.name + ".svg"));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(can_pack) {
|
if(can_pack) {
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
enum NSVGpaintType {
|
enum NSVGpaintType {
|
||||||
|
NSVG_PAINT_UNDEF = -1,
|
||||||
NSVG_PAINT_NONE = 0,
|
NSVG_PAINT_NONE = 0,
|
||||||
NSVG_PAINT_COLOR = 1,
|
NSVG_PAINT_COLOR = 1,
|
||||||
NSVG_PAINT_LINEAR_GRADIENT = 2,
|
NSVG_PAINT_LINEAR_GRADIENT = 2,
|
||||||
@@ -119,7 +120,7 @@ typedef struct NSVGgradient {
|
|||||||
} NSVGgradient;
|
} NSVGgradient;
|
||||||
|
|
||||||
typedef struct NSVGpaint {
|
typedef struct NSVGpaint {
|
||||||
char type;
|
signed char type;
|
||||||
union {
|
union {
|
||||||
unsigned int color;
|
unsigned int color;
|
||||||
NSVGgradient* gradient;
|
NSVGgradient* gradient;
|
||||||
@@ -143,14 +144,17 @@ typedef struct NSVGshape
|
|||||||
float opacity; // Opacity of the shape.
|
float opacity; // Opacity of the shape.
|
||||||
float strokeWidth; // Stroke width (scaled).
|
float strokeWidth; // Stroke width (scaled).
|
||||||
float strokeDashOffset; // Stroke dash offset (scaled).
|
float strokeDashOffset; // Stroke dash offset (scaled).
|
||||||
float strokeDashArray[8]; // Stroke dash array (scaled).
|
float strokeDashArray[8]; // Stroke dash array (scaled).
|
||||||
char strokeDashCount; // Number of dash values in dash array.
|
char strokeDashCount; // Number of dash values in dash array.
|
||||||
char strokeLineJoin; // Stroke join type.
|
char strokeLineJoin; // Stroke join type.
|
||||||
char strokeLineCap; // Stroke cap type.
|
char strokeLineCap; // Stroke cap type.
|
||||||
float miterLimit; // Miter limit
|
float miterLimit; // Miter limit
|
||||||
char fillRule; // Fill rule, see NSVGfillRule.
|
char fillRule; // Fill rule, see NSVGfillRule.
|
||||||
unsigned char flags; // Logical or of NSVG_FLAGS_* flags
|
unsigned char flags; // Logical or of NSVG_FLAGS_* flags
|
||||||
float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy].
|
float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy].
|
||||||
|
char fillGradient[64]; // Optional 'id' of fill gradient
|
||||||
|
char strokeGradient[64]; // Optional 'id' of stroke gradient
|
||||||
|
float xform[6]; // Root transformation for fill/stroke gradient
|
||||||
NSVGpath* paths; // Linked list of paths in the image.
|
NSVGpath* paths; // Linked list of paths in the image.
|
||||||
struct NSVGshape* next; // Pointer to next shape, or NULL if last element.
|
struct NSVGshape* next; // Pointer to next shape, or NULL if last element.
|
||||||
} NSVGshape;
|
} NSVGshape;
|
||||||
@@ -181,16 +185,14 @@ void nsvgDelete(NSVGimage* image);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // NANOSVG_H
|
|
||||||
|
|
||||||
#ifdef NANOSVG_IMPLEMENTATION
|
#ifdef NANOSVG_IMPLEMENTATION
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
|
||||||
|
|
||||||
#define NSVG_PI (3.14159265358979323846264338327f)
|
#define NSVG_PI (3.14159265358979323846264338327f)
|
||||||
#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs.
|
#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs.
|
||||||
|
|
||||||
@@ -227,11 +229,6 @@ static int nsvg__isdigit(char c)
|
|||||||
return c >= '0' && c <= '9';
|
return c >= '0' && c <= '9';
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nsvg__isnum(char c)
|
|
||||||
{
|
|
||||||
return strchr("0123456789+-.eE", c) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; }
|
static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; }
|
||||||
static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; }
|
static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; }
|
||||||
|
|
||||||
@@ -402,7 +399,7 @@ typedef struct NSVGgradientData
|
|||||||
{
|
{
|
||||||
char id[64];
|
char id[64];
|
||||||
char ref[64];
|
char ref[64];
|
||||||
char type;
|
signed char type;
|
||||||
union {
|
union {
|
||||||
NSVGlinearData linear;
|
NSVGlinearData linear;
|
||||||
NSVGradialData radial;
|
NSVGradialData radial;
|
||||||
@@ -618,7 +615,7 @@ static void nsvg__curveBounds(float* bounds, float* curve)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSVGparser* nsvg__createParser()
|
static NSVGparser* nsvg__createParser(void)
|
||||||
{
|
{
|
||||||
NSVGparser* p;
|
NSVGparser* p;
|
||||||
p = (NSVGparser*)malloc(sizeof(NSVGparser));
|
p = (NSVGparser*)malloc(sizeof(NSVGparser));
|
||||||
@@ -738,9 +735,11 @@ static void nsvg__lineTo(NSVGparser* p, float x, float y)
|
|||||||
|
|
||||||
static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y)
|
static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y)
|
||||||
{
|
{
|
||||||
nsvg__addPoint(p, cpx1, cpy1);
|
if (p->npts > 0) {
|
||||||
nsvg__addPoint(p, cpx2, cpy2);
|
nsvg__addPoint(p, cpx1, cpy1);
|
||||||
nsvg__addPoint(p, x, y);
|
nsvg__addPoint(p, cpx2, cpy2);
|
||||||
|
nsvg__addPoint(p, x, y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSVGattrib* nsvg__getAttr(NSVGparser* p)
|
static NSVGattrib* nsvg__getAttr(NSVGparser* p)
|
||||||
@@ -810,7 +809,9 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig,
|
|||||||
static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
|
static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
|
||||||
{
|
{
|
||||||
NSVGgradientData* grad = p->gradients;
|
NSVGgradientData* grad = p->gradients;
|
||||||
while (grad) {
|
if (id == NULL || *id == '\0')
|
||||||
|
return NULL;
|
||||||
|
while (grad != NULL) {
|
||||||
if (strcmp(grad->id, id) == 0)
|
if (strcmp(grad->id, id) == 0)
|
||||||
return grad;
|
return grad;
|
||||||
grad = grad->next;
|
grad = grad->next;
|
||||||
@@ -818,28 +819,34 @@ static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, char* paintType)
|
static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, float *xform, signed char* paintType)
|
||||||
{
|
{
|
||||||
NSVGattrib* attr = nsvg__getAttr(p);
|
|
||||||
NSVGgradientData* data = NULL;
|
NSVGgradientData* data = NULL;
|
||||||
NSVGgradientData* ref = NULL;
|
NSVGgradientData* ref = NULL;
|
||||||
NSVGgradientStop* stops = NULL;
|
NSVGgradientStop* stops = NULL;
|
||||||
NSVGgradient* grad;
|
NSVGgradient* grad;
|
||||||
float ox, oy, sw, sh, sl;
|
float ox, oy, sw, sh, sl;
|
||||||
int nstops = 0;
|
int nstops = 0;
|
||||||
|
int refIter;
|
||||||
|
|
||||||
data = nsvg__findGradientData(p, id);
|
data = nsvg__findGradientData(p, id);
|
||||||
if (data == NULL) return NULL;
|
if (data == NULL) return NULL;
|
||||||
|
|
||||||
// TODO: use ref to fill in all unset values too.
|
// TODO: use ref to fill in all unset values too.
|
||||||
ref = data;
|
ref = data;
|
||||||
|
refIter = 0;
|
||||||
while (ref != NULL) {
|
while (ref != NULL) {
|
||||||
|
NSVGgradientData* nextRef = NULL;
|
||||||
if (stops == NULL && ref->stops != NULL) {
|
if (stops == NULL && ref->stops != NULL) {
|
||||||
stops = ref->stops;
|
stops = ref->stops;
|
||||||
nstops = ref->nstops;
|
nstops = ref->nstops;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ref = nsvg__findGradientData(p, ref->ref);
|
nextRef = nsvg__findGradientData(p, ref->ref);
|
||||||
|
if (nextRef == ref) break; // prevent infite loops on malformed data
|
||||||
|
ref = nextRef;
|
||||||
|
refIter++;
|
||||||
|
if (refIter > 32) break; // prevent infite loops on malformed data
|
||||||
}
|
}
|
||||||
if (stops == NULL) return NULL;
|
if (stops == NULL) return NULL;
|
||||||
|
|
||||||
@@ -888,7 +895,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsvg__xformMultiply(grad->xform, data->xform);
|
nsvg__xformMultiply(grad->xform, data->xform);
|
||||||
nsvg__xformMultiply(grad->xform, attr->xform);
|
nsvg__xformMultiply(grad->xform, xform);
|
||||||
|
|
||||||
grad->spread = data->spread;
|
grad->spread = data->spread;
|
||||||
memcpy(grad->stops, stops, nstops*sizeof(NSVGgradientStop));
|
memcpy(grad->stops, stops, nstops*sizeof(NSVGgradientStop));
|
||||||
@@ -952,6 +959,9 @@ static void nsvg__addShape(NSVGparser* p)
|
|||||||
memset(shape, 0, sizeof(NSVGshape));
|
memset(shape, 0, sizeof(NSVGshape));
|
||||||
|
|
||||||
memcpy(shape->id, attr->id, sizeof shape->id);
|
memcpy(shape->id, attr->id, sizeof shape->id);
|
||||||
|
memcpy(shape->fillGradient, attr->fillGradient, sizeof shape->fillGradient);
|
||||||
|
memcpy(shape->strokeGradient, attr->strokeGradient, sizeof shape->strokeGradient);
|
||||||
|
memcpy(shape->xform, attr->xform, sizeof shape->xform);
|
||||||
scale = nsvg__getAverageScale(attr->xform);
|
scale = nsvg__getAverageScale(attr->xform);
|
||||||
shape->strokeWidth = attr->strokeWidth * scale;
|
shape->strokeWidth = attr->strokeWidth * scale;
|
||||||
shape->strokeDashOffset = attr->strokeDashOffset * scale;
|
shape->strokeDashOffset = attr->strokeDashOffset * scale;
|
||||||
@@ -987,13 +997,7 @@ static void nsvg__addShape(NSVGparser* p)
|
|||||||
shape->fill.color = attr->fillColor;
|
shape->fill.color = attr->fillColor;
|
||||||
shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24;
|
shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24;
|
||||||
} else if (attr->hasFill == 2) {
|
} else if (attr->hasFill == 2) {
|
||||||
float inv[6], localBounds[4];
|
shape->fill.type = NSVG_PAINT_UNDEF;
|
||||||
nsvg__xformInverse(inv, attr->xform);
|
|
||||||
nsvg__getLocalBounds(localBounds, shape, inv);
|
|
||||||
shape->fill.gradient = nsvg__createGradient(p, attr->fillGradient, localBounds, &shape->fill.type);
|
|
||||||
if (shape->fill.gradient == NULL) {
|
|
||||||
shape->fill.type = NSVG_PAINT_NONE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set stroke
|
// Set stroke
|
||||||
@@ -1004,12 +1008,7 @@ static void nsvg__addShape(NSVGparser* p)
|
|||||||
shape->stroke.color = attr->strokeColor;
|
shape->stroke.color = attr->strokeColor;
|
||||||
shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24;
|
shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24;
|
||||||
} else if (attr->hasStroke == 2) {
|
} else if (attr->hasStroke == 2) {
|
||||||
float inv[6], localBounds[4];
|
shape->stroke.type = NSVG_PAINT_UNDEF;
|
||||||
nsvg__xformInverse(inv, attr->xform);
|
|
||||||
nsvg__getLocalBounds(localBounds, shape, inv);
|
|
||||||
shape->stroke.gradient = nsvg__createGradient(p, attr->strokeGradient, localBounds, &shape->stroke.type);
|
|
||||||
if (shape->stroke.gradient == NULL)
|
|
||||||
shape->stroke.type = NSVG_PAINT_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set flags
|
// Set flags
|
||||||
@@ -1042,6 +1041,10 @@ static void nsvg__addPath(NSVGparser* p, char closed)
|
|||||||
if (closed)
|
if (closed)
|
||||||
nsvg__lineTo(p, p->pts[0], p->pts[1]);
|
nsvg__lineTo(p, p->pts[0], p->pts[1]);
|
||||||
|
|
||||||
|
// Expect 1 + N*3 points (N = number of cubic bezier segments).
|
||||||
|
if ((p->npts % 3) != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
path = (NSVGpath*)malloc(sizeof(NSVGpath));
|
path = (NSVGpath*)malloc(sizeof(NSVGpath));
|
||||||
if (path == NULL) goto error;
|
if (path == NULL) goto error;
|
||||||
memset(path, 0, sizeof(NSVGpath));
|
memset(path, 0, sizeof(NSVGpath));
|
||||||
@@ -1090,7 +1093,7 @@ static double nsvg__atof(const char* s)
|
|||||||
char* cur = (char*)s;
|
char* cur = (char*)s;
|
||||||
char* end = NULL;
|
char* end = NULL;
|
||||||
double res = 0.0, sign = 1.0;
|
double res = 0.0, sign = 1.0;
|
||||||
long long intPart = 0, fracPart = 0;
|
double intPart = 0.0, fracPart = 0.0;
|
||||||
char hasIntPart = 0, hasFracPart = 0;
|
char hasIntPart = 0, hasFracPart = 0;
|
||||||
|
|
||||||
// Parse optional sign
|
// Parse optional sign
|
||||||
@@ -1104,9 +1107,13 @@ static double nsvg__atof(const char* s)
|
|||||||
// Parse integer part
|
// Parse integer part
|
||||||
if (nsvg__isdigit(*cur)) {
|
if (nsvg__isdigit(*cur)) {
|
||||||
// Parse digit sequence
|
// Parse digit sequence
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
intPart = (double)_strtoi64(cur, &end, 10);
|
||||||
|
#else
|
||||||
intPart = (double)strtoll(cur, &end, 10);
|
intPart = (double)strtoll(cur, &end, 10);
|
||||||
|
#endif
|
||||||
if (cur != end) {
|
if (cur != end) {
|
||||||
res = (double)intPart;
|
res = intPart;
|
||||||
hasIntPart = 1;
|
hasIntPart = 1;
|
||||||
cur = end;
|
cur = end;
|
||||||
}
|
}
|
||||||
@@ -1117,9 +1124,13 @@ static double nsvg__atof(const char* s)
|
|||||||
cur++; // Skip '.'
|
cur++; // Skip '.'
|
||||||
if (nsvg__isdigit(*cur)) {
|
if (nsvg__isdigit(*cur)) {
|
||||||
// Parse digit sequence
|
// Parse digit sequence
|
||||||
fracPart = strtoll(cur, &end, 10);
|
#ifdef _MSC_VER
|
||||||
|
fracPart = (double)_strtoi64(cur, &end, 10);
|
||||||
|
#else
|
||||||
|
fracPart = (double)strtoll(cur, &end, 10);
|
||||||
|
#endif
|
||||||
if (cur != end) {
|
if (cur != end) {
|
||||||
res += (double)fracPart / pow(10.0, (double)(end - cur));
|
res += fracPart / pow(10.0, (double)(end - cur));
|
||||||
hasFracPart = 1;
|
hasFracPart = 1;
|
||||||
cur = end;
|
cur = end;
|
||||||
}
|
}
|
||||||
@@ -1132,11 +1143,11 @@ static double nsvg__atof(const char* s)
|
|||||||
|
|
||||||
// Parse optional exponent
|
// Parse optional exponent
|
||||||
if (*cur == 'e' || *cur == 'E') {
|
if (*cur == 'e' || *cur == 'E') {
|
||||||
int expPart = 0;
|
double expPart = 0.0;
|
||||||
cur++; // skip 'E'
|
cur++; // skip 'E'
|
||||||
expPart = strtol(cur, &end, 10); // Parse digit sequence with sign
|
expPart = (double)strtol(cur, &end, 10); // Parse digit sequence with sign
|
||||||
if (cur != end) {
|
if (cur != end) {
|
||||||
res *= pow(10.0, (double)expPart);
|
res *= pow(10.0, expPart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1170,7 +1181,7 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// exponent
|
// exponent
|
||||||
if (*s == 'e' || *s == 'E') {
|
if ((*s == 'e' || *s == 'E') && (s[1] != 'm' && s[1] != 'x')) {
|
||||||
if (i < last) it[i++] = *s;
|
if (i < last) it[i++] = *s;
|
||||||
s++;
|
s++;
|
||||||
if (*s == '-' || *s == '+') {
|
if (*s == '-' || *s == '+') {
|
||||||
@@ -1187,6 +1198,20 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char* nsvg__getNextPathItemWhenArcFlag(const char* s, char* it)
|
||||||
|
{
|
||||||
|
it[0] = '\0';
|
||||||
|
while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
|
||||||
|
if (!*s) return s;
|
||||||
|
if (*s == '0' || *s == '1') {
|
||||||
|
it[0] = *s++;
|
||||||
|
it[1] = '\0';
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char* nsvg__getNextPathItem(const char* s, char* it)
|
static const char* nsvg__getNextPathItem(const char* s, char* it)
|
||||||
{
|
{
|
||||||
it[0] = '\0';
|
it[0] = '\0';
|
||||||
@@ -1207,35 +1232,66 @@ static const char* nsvg__getNextPathItem(const char* s, char* it)
|
|||||||
|
|
||||||
static unsigned int nsvg__parseColorHex(const char* str)
|
static unsigned int nsvg__parseColorHex(const char* str)
|
||||||
{
|
{
|
||||||
unsigned int c = 0, r = 0, g = 0, b = 0;
|
unsigned int r=0, g=0, b=0;
|
||||||
int n = 0;
|
if (sscanf(str, "#%2x%2x%2x", &r, &g, &b) == 3 ) // 2 digit hex
|
||||||
str++; // skip #
|
return NSVG_RGB(r, g, b);
|
||||||
// Calculate number of characters.
|
if (sscanf(str, "#%1x%1x%1x", &r, &g, &b) == 3 ) // 1 digit hex, e.g. #abc -> 0xccbbaa
|
||||||
while(str[n] && !nsvg__isspace(str[n]))
|
return NSVG_RGB(r*17, g*17, b*17); // same effect as (r<<4|r), (g<<4|g), ..
|
||||||
n++;
|
return NSVG_RGB(128, 128, 128);
|
||||||
if (n == 6) {
|
|
||||||
sscanf(str, "%x", &c);
|
|
||||||
} else if (n == 3) {
|
|
||||||
sscanf(str, "%x", &c);
|
|
||||||
c = (c&0xf) | ((c&0xf0) << 4) | ((c&0xf00) << 8);
|
|
||||||
c |= c<<4;
|
|
||||||
}
|
|
||||||
r = (c >> 16) & 0xff;
|
|
||||||
g = (c >> 8) & 0xff;
|
|
||||||
b = c & 0xff;
|
|
||||||
return NSVG_RGB(r,g,b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse rgb color. The pointer 'str' must point at "rgb(" (4+ characters).
|
||||||
|
// This function returns gray (rgb(128, 128, 128) == '#808080') on parse errors
|
||||||
|
// for backwards compatibility. Note: other image viewers return black instead.
|
||||||
|
|
||||||
static unsigned int nsvg__parseColorRGB(const char* str)
|
static unsigned int nsvg__parseColorRGB(const char* str)
|
||||||
{
|
{
|
||||||
int r = -1, g = -1, b = -1;
|
int i;
|
||||||
char s1[32]="", s2[32]="";
|
unsigned int rgbi[3];
|
||||||
sscanf(str + 4, "%d%[%%, \t]%d%[%%, \t]%d", &r, s1, &g, s2, &b);
|
float rgbf[3];
|
||||||
if (strchr(s1, '%')) {
|
// try decimal integers first
|
||||||
return NSVG_RGB((r*255)/100,(g*255)/100,(b*255)/100);
|
if (sscanf(str, "rgb(%u, %u, %u)", &rgbi[0], &rgbi[1], &rgbi[2]) != 3) {
|
||||||
} else {
|
// integers failed, try percent values (float, locale independent)
|
||||||
return NSVG_RGB(r,g,b);
|
const char delimiter[3] = {',', ',', ')'};
|
||||||
|
str += 4; // skip "rgb("
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
while (*str && (nsvg__isspace(*str))) str++; // skip leading spaces
|
||||||
|
if (*str == '+') str++; // skip '+' (don't allow '-')
|
||||||
|
if (!*str) break;
|
||||||
|
rgbf[i] = nsvg__atof(str);
|
||||||
|
|
||||||
|
// Note 1: it would be great if nsvg__atof() returned how many
|
||||||
|
// bytes it consumed but it doesn't. We need to skip the number,
|
||||||
|
// the '%' character, spaces, and the delimiter ',' or ')'.
|
||||||
|
|
||||||
|
// Note 2: The following code does not allow values like "33.%",
|
||||||
|
// i.e. a decimal point w/o fractional part, but this is consistent
|
||||||
|
// with other image viewers, e.g. firefox, chrome, eog, gimp.
|
||||||
|
|
||||||
|
while (*str && nsvg__isdigit(*str)) str++; // skip integer part
|
||||||
|
if (*str == '.') {
|
||||||
|
str++;
|
||||||
|
if (!nsvg__isdigit(*str)) break; // error: no digit after '.'
|
||||||
|
while (*str && nsvg__isdigit(*str)) str++; // skip fractional part
|
||||||
|
}
|
||||||
|
if (*str == '%') str++; else break;
|
||||||
|
while (nsvg__isspace(*str)) str++;
|
||||||
|
if (*str == delimiter[i]) str++;
|
||||||
|
else break;
|
||||||
|
}
|
||||||
|
if (i == 3) {
|
||||||
|
rgbi[0] = roundf(rgbf[0] * 2.55f);
|
||||||
|
rgbi[1] = roundf(rgbf[1] * 2.55f);
|
||||||
|
rgbi[2] = roundf(rgbf[2] * 2.55f);
|
||||||
|
} else {
|
||||||
|
rgbi[0] = rgbi[1] = rgbi[2] = 128;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// clip values as the CSS spec requires
|
||||||
|
for (i = 0; i < 3; i++) {
|
||||||
|
if (rgbi[i] > 255) rgbi[i] = 255;
|
||||||
|
}
|
||||||
|
return NSVG_RGB(rgbi[0], rgbi[1], rgbi[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct NSVGNamedColor {
|
typedef struct NSVGNamedColor {
|
||||||
@@ -1460,6 +1516,15 @@ static int nsvg__parseUnits(const char* units)
|
|||||||
return NSVG_UNITS_USER;
|
return NSVG_UNITS_USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nsvg__isCoordinate(const char* s)
|
||||||
|
{
|
||||||
|
// optional sign
|
||||||
|
if (*s == '-' || *s == '+')
|
||||||
|
s++;
|
||||||
|
// must have at least one digit, or start by a dot
|
||||||
|
return (nsvg__isdigit(*s) || *s == '.');
|
||||||
|
}
|
||||||
|
|
||||||
static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
|
static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
|
||||||
{
|
{
|
||||||
NSVGcoordinate coord = {0, NSVG_UNITS_USER};
|
NSVGcoordinate coord = {0, NSVG_UNITS_USER};
|
||||||
@@ -1599,25 +1664,32 @@ static int nsvg__parseRotate(float* xform, const char* str)
|
|||||||
static void nsvg__parseTransform(float* xform, const char* str)
|
static void nsvg__parseTransform(float* xform, const char* str)
|
||||||
{
|
{
|
||||||
float t[6];
|
float t[6];
|
||||||
|
int len;
|
||||||
nsvg__xformIdentity(xform);
|
nsvg__xformIdentity(xform);
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
if (strncmp(str, "matrix", 6) == 0)
|
if (strncmp(str, "matrix", 6) == 0)
|
||||||
str += nsvg__parseMatrix(t, str);
|
len = nsvg__parseMatrix(t, str);
|
||||||
else if (strncmp(str, "translate", 9) == 0)
|
else if (strncmp(str, "translate", 9) == 0)
|
||||||
str += nsvg__parseTranslate(t, str);
|
len = nsvg__parseTranslate(t, str);
|
||||||
else if (strncmp(str, "scale", 5) == 0)
|
else if (strncmp(str, "scale", 5) == 0)
|
||||||
str += nsvg__parseScale(t, str);
|
len = nsvg__parseScale(t, str);
|
||||||
else if (strncmp(str, "rotate", 6) == 0)
|
else if (strncmp(str, "rotate", 6) == 0)
|
||||||
str += nsvg__parseRotate(t, str);
|
len = nsvg__parseRotate(t, str);
|
||||||
else if (strncmp(str, "skewX", 5) == 0)
|
else if (strncmp(str, "skewX", 5) == 0)
|
||||||
str += nsvg__parseSkewX(t, str);
|
len = nsvg__parseSkewX(t, str);
|
||||||
else if (strncmp(str, "skewY", 5) == 0)
|
else if (strncmp(str, "skewY", 5) == 0)
|
||||||
str += nsvg__parseSkewY(t, str);
|
len = nsvg__parseSkewY(t, str);
|
||||||
else{
|
else{
|
||||||
++str;
|
++str;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (len != 0) {
|
||||||
|
str += len;
|
||||||
|
} else {
|
||||||
|
++str;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
nsvg__xformPremultiply(xform, t);
|
nsvg__xformPremultiply(xform, t);
|
||||||
}
|
}
|
||||||
@@ -1627,9 +1699,9 @@ static void nsvg__parseUrl(char* id, const char* str)
|
|||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
str += 4; // "url(";
|
str += 4; // "url(";
|
||||||
if (*str == '#')
|
if (*str && *str == '#')
|
||||||
str++;
|
str++;
|
||||||
while (i < 63 && *str != ')') {
|
while (i < 63 && *str && *str != ')') {
|
||||||
id[i] = *str++;
|
id[i] = *str++;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -1878,8 +1950,11 @@ static int nsvg__getArgsPerElement(char cmd)
|
|||||||
case 'a':
|
case 'a':
|
||||||
case 'A':
|
case 'A':
|
||||||
return 7;
|
return 7;
|
||||||
|
case 'z':
|
||||||
|
case 'Z':
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
|
static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
|
||||||
@@ -2160,7 +2235,12 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
|
|||||||
// The loop assumes an iteration per end point (including start and end), this +1.
|
// The loop assumes an iteration per end point (including start and end), this +1.
|
||||||
ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f);
|
ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f);
|
||||||
hda = (da / (float)ndivs) / 2.0f;
|
hda = (da / (float)ndivs) / 2.0f;
|
||||||
kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda));
|
// Fix for ticket #179: division by 0: avoid cotangens around 0 (infinite)
|
||||||
|
if ((hda < 1e-3f) && (hda > -1e-3f))
|
||||||
|
hda *= 0.5f;
|
||||||
|
else
|
||||||
|
hda = (1.0f - cosf(hda)) / sinf(hda);
|
||||||
|
kappa = fabsf(4.0f / 3.0f * hda);
|
||||||
if (da < 0.0f)
|
if (da < 0.0f)
|
||||||
kappa = -kappa;
|
kappa = -kappa;
|
||||||
|
|
||||||
@@ -2189,6 +2269,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
|||||||
float args[10];
|
float args[10];
|
||||||
int nargs;
|
int nargs;
|
||||||
int rargs = 0;
|
int rargs = 0;
|
||||||
|
char initPoint;
|
||||||
float cpx, cpy, cpx2, cpy2;
|
float cpx, cpy, cpx2, cpy2;
|
||||||
const char* tmp[4];
|
const char* tmp[4];
|
||||||
char closedFlag;
|
char closedFlag;
|
||||||
@@ -2211,13 +2292,18 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
|||||||
nsvg__resetPath(p);
|
nsvg__resetPath(p);
|
||||||
cpx = 0; cpy = 0;
|
cpx = 0; cpy = 0;
|
||||||
cpx2 = 0; cpy2 = 0;
|
cpx2 = 0; cpy2 = 0;
|
||||||
|
initPoint = 0;
|
||||||
closedFlag = 0;
|
closedFlag = 0;
|
||||||
nargs = 0;
|
nargs = 0;
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
s = nsvg__getNextPathItem(s, item);
|
item[0] = '\0';
|
||||||
|
if ((cmd == 'A' || cmd == 'a') && (nargs == 3 || nargs == 4))
|
||||||
|
s = nsvg__getNextPathItemWhenArcFlag(s, item);
|
||||||
|
if (!*item)
|
||||||
|
s = nsvg__getNextPathItem(s, item);
|
||||||
if (!*item) break;
|
if (!*item) break;
|
||||||
if (nsvg__isnum(item[0])) {
|
if (cmd != '\0' && nsvg__isCoordinate(item)) {
|
||||||
if (nargs < 10)
|
if (nargs < 10)
|
||||||
args[nargs++] = (float)nsvg__atof(item);
|
args[nargs++] = (float)nsvg__atof(item);
|
||||||
if (nargs >= rargs) {
|
if (nargs >= rargs) {
|
||||||
@@ -2230,6 +2316,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
|||||||
cmd = (cmd == 'm') ? 'l' : 'L';
|
cmd = (cmd == 'm') ? 'l' : 'L';
|
||||||
rargs = nsvg__getArgsPerElement(cmd);
|
rargs = nsvg__getArgsPerElement(cmd);
|
||||||
cpx2 = cpx; cpy2 = cpy;
|
cpx2 = cpx; cpy2 = cpy;
|
||||||
|
initPoint = 1;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'L':
|
case 'L':
|
||||||
@@ -2279,7 +2366,6 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cmd = item[0];
|
cmd = item[0];
|
||||||
rargs = nsvg__getArgsPerElement(cmd);
|
|
||||||
if (cmd == 'M' || cmd == 'm') {
|
if (cmd == 'M' || cmd == 'm') {
|
||||||
// Commit path.
|
// Commit path.
|
||||||
if (p->npts > 0)
|
if (p->npts > 0)
|
||||||
@@ -2288,7 +2374,11 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
|||||||
nsvg__resetPath(p);
|
nsvg__resetPath(p);
|
||||||
closedFlag = 0;
|
closedFlag = 0;
|
||||||
nargs = 0;
|
nargs = 0;
|
||||||
} else if (cmd == 'Z' || cmd == 'z') {
|
} else if (initPoint == 0) {
|
||||||
|
// Do not allow other commands until initial point has been set (moveTo called once).
|
||||||
|
cmd = '\0';
|
||||||
|
}
|
||||||
|
if (cmd == 'Z' || cmd == 'z') {
|
||||||
closedFlag = 1;
|
closedFlag = 1;
|
||||||
// Commit path.
|
// Commit path.
|
||||||
if (p->npts > 0) {
|
if (p->npts > 0) {
|
||||||
@@ -2304,6 +2394,12 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
|
|||||||
closedFlag = 0;
|
closedFlag = 0;
|
||||||
nargs = 0;
|
nargs = 0;
|
||||||
}
|
}
|
||||||
|
rargs = nsvg__getArgsPerElement(cmd);
|
||||||
|
if (rargs == -1) {
|
||||||
|
// Command not recognized
|
||||||
|
cmd = '\0';
|
||||||
|
rargs = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Commit path.
|
// Commit path.
|
||||||
@@ -2550,7 +2646,7 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type)
|
static void nsvg__parseGradient(NSVGparser* p, const char** attr, signed char type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
NSVGgradientData* grad = (NSVGgradientData*)malloc(sizeof(NSVGgradientData));
|
NSVGgradientData* grad = (NSVGgradientData*)malloc(sizeof(NSVGgradientData));
|
||||||
@@ -2875,6 +2971,36 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nsvg__createGradients(NSVGparser* p)
|
||||||
|
{
|
||||||
|
NSVGshape* shape;
|
||||||
|
|
||||||
|
for (shape = p->image->shapes; shape != NULL; shape = shape->next) {
|
||||||
|
if (shape->fill.type == NSVG_PAINT_UNDEF) {
|
||||||
|
if (shape->fillGradient[0] != '\0') {
|
||||||
|
float inv[6], localBounds[4];
|
||||||
|
nsvg__xformInverse(inv, shape->xform);
|
||||||
|
nsvg__getLocalBounds(localBounds, shape, inv);
|
||||||
|
shape->fill.gradient = nsvg__createGradient(p, shape->fillGradient, localBounds, shape->xform, &shape->fill.type);
|
||||||
|
}
|
||||||
|
if (shape->fill.type == NSVG_PAINT_UNDEF) {
|
||||||
|
shape->fill.type = NSVG_PAINT_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shape->stroke.type == NSVG_PAINT_UNDEF) {
|
||||||
|
if (shape->strokeGradient[0] != '\0') {
|
||||||
|
float inv[6], localBounds[4];
|
||||||
|
nsvg__xformInverse(inv, shape->xform);
|
||||||
|
nsvg__getLocalBounds(localBounds, shape, inv);
|
||||||
|
shape->stroke.gradient = nsvg__createGradient(p, shape->strokeGradient, localBounds, shape->xform, &shape->stroke.type);
|
||||||
|
}
|
||||||
|
if (shape->stroke.type == NSVG_PAINT_UNDEF) {
|
||||||
|
shape->stroke.type = NSVG_PAINT_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NSVGimage* nsvgParse(char* input, const char* units, float dpi)
|
NSVGimage* nsvgParse(char* input, const char* units, float dpi)
|
||||||
{
|
{
|
||||||
NSVGparser* p;
|
NSVGparser* p;
|
||||||
@@ -2888,6 +3014,9 @@ NSVGimage* nsvgParse(char* input, const char* units, float dpi)
|
|||||||
|
|
||||||
nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p);
|
nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p);
|
||||||
|
|
||||||
|
// Create gradients after all definitions have been parsed
|
||||||
|
nsvg__createGradients(p);
|
||||||
|
|
||||||
// Scale to viewBox
|
// Scale to viewBox
|
||||||
nsvg__scaleToViewbox(p, units);
|
nsvg__scaleToViewbox(p, units);
|
||||||
|
|
||||||
@@ -2899,7 +3028,10 @@ NSVGimage* nsvgParse(char* input, const char* units, float dpi)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <boost/nowide/cstdio.hpp>
|
#if WIN32
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include "windows.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
|
NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
|
||||||
{
|
{
|
||||||
@@ -2908,8 +3040,17 @@ NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
|
|||||||
char* data = NULL;
|
char* data = NULL;
|
||||||
NSVGimage* image = NULL;
|
NSVGimage* image = NULL;
|
||||||
|
|
||||||
fp = boost::nowide::fopen(filename, "rb");
|
#if WIN32
|
||||||
if (!fp) goto error;
|
int name_len = MultiByteToWideChar(CP_UTF8, NULL, filename, strlen(filename), NULL, 0);
|
||||||
|
wchar_t w_fname[512];
|
||||||
|
memset(w_fname, 0, sizeof(w_fname));
|
||||||
|
MultiByteToWideChar(CP_UTF8, NULL, filename, strlen(filename), w_fname, name_len);
|
||||||
|
w_fname[name_len] = '\0';
|
||||||
|
fp = _wfopen(w_fname, L"rb");
|
||||||
|
#else
|
||||||
|
fp = fopen(filename, "rb");
|
||||||
|
#endif
|
||||||
|
if (!fp) goto error;
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
size = ftell(fp);
|
size = ftell(fp);
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
@@ -2918,9 +3059,9 @@ NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
|
|||||||
if (fread(data, 1, size, fp) != size) goto error;
|
if (fread(data, 1, size, fp) != size) goto error;
|
||||||
data[size] = '\0'; // Must be null terminated.
|
data[size] = '\0'; // Must be null terminated.
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
image = nsvgParse(data, units, dpi);
|
image = nsvgParse(data, units, dpi);
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
@@ -2976,4 +3117,6 @@ void nsvgDelete(NSVGimage* image)
|
|||||||
free(image);
|
free(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // NANOSVG_IMPLEMENTATION
|
||||||
|
|
||||||
|
#endif // NANOSVG_H
|
||||||
|
|||||||
@@ -22,9 +22,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Modified by FLTK to support non-square X,Y axes scaling.
|
||||||
|
*
|
||||||
|
* Added: nsvgRasterizeXY()
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef NANOSVGRAST_H
|
#ifndef NANOSVGRAST_H
|
||||||
#define NANOSVGRAST_H
|
#define NANOSVGRAST_H
|
||||||
|
|
||||||
|
#include "nanosvg.h"
|
||||||
|
|
||||||
#ifndef NANOSVGRAST_CPLUSPLUS
|
#ifndef NANOSVGRAST_CPLUSPLUS
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -44,16 +51,19 @@ typedef struct NSVGrasterizer NSVGrasterizer;
|
|||||||
unsigned char* img = malloc(w*h*4);
|
unsigned char* img = malloc(w*h*4);
|
||||||
// Rasterize
|
// Rasterize
|
||||||
nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
|
nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
|
||||||
|
|
||||||
|
// For non-square X,Y scaling, use
|
||||||
|
nsvgRasterizeXY(rast, image, 0,0,1,1, img, w, h, w*4);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Allocated rasterizer context.
|
// Allocated rasterizer context.
|
||||||
NSVGrasterizer* nsvgCreateRasterizer();
|
NSVGrasterizer* nsvgCreateRasterizer(void);
|
||||||
|
|
||||||
// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
|
// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
|
||||||
// r - pointer to rasterizer context
|
// r - pointer to rasterizer context
|
||||||
// image - pointer to image to rasterize
|
// image - pointer to image to rasterize
|
||||||
// tx,ty - image offset (applied after scaling)
|
// tx,ty - image offset (applied after scaling)
|
||||||
// scale - image scale
|
// scale - image scale (assumes square aspect ratio)
|
||||||
// dst - pointer to destination image data, 4 bytes per pixel (RGBA)
|
// dst - pointer to destination image data, 4 bytes per pixel (RGBA)
|
||||||
// w - width of the image to render
|
// w - width of the image to render
|
||||||
// h - height of the image to render
|
// h - height of the image to render
|
||||||
@@ -62,6 +72,12 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
NSVGimage* image, float tx, float ty, float scale,
|
NSVGimage* image, float tx, float ty, float scale,
|
||||||
unsigned char* dst, int w, int h, int stride);
|
unsigned char* dst, int w, int h, int stride);
|
||||||
|
|
||||||
|
// As above, but allow X and Y axes to scale independently for non-square aspects
|
||||||
|
void nsvgRasterizeXY(NSVGrasterizer* r,
|
||||||
|
NSVGimage* image, float tx, float ty,
|
||||||
|
float sx, float sy,
|
||||||
|
unsigned char* dst, int w, int h, int stride);
|
||||||
|
|
||||||
// Deletes rasterizer context.
|
// Deletes rasterizer context.
|
||||||
void nsvgDeleteRasterizer(NSVGrasterizer*);
|
void nsvgDeleteRasterizer(NSVGrasterizer*);
|
||||||
|
|
||||||
@@ -72,11 +88,11 @@ void nsvgDeleteRasterizer(NSVGrasterizer*);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // NANOSVGRAST_H
|
|
||||||
|
|
||||||
#ifdef NANOSVGRAST_IMPLEMENTATION
|
#ifdef NANOSVGRAST_IMPLEMENTATION
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define NSVG__SUBSAMPLES 5
|
#define NSVG__SUBSAMPLES 5
|
||||||
#define NSVG__FIXSHIFT 10
|
#define NSVG__FIXSHIFT 10
|
||||||
@@ -112,7 +128,7 @@ typedef struct NSVGmemPage {
|
|||||||
} NSVGmemPage;
|
} NSVGmemPage;
|
||||||
|
|
||||||
typedef struct NSVGcachedPaint {
|
typedef struct NSVGcachedPaint {
|
||||||
char type;
|
signed char type;
|
||||||
char spread;
|
char spread;
|
||||||
float xform[6];
|
float xform[6];
|
||||||
unsigned int colors[256];
|
unsigned int colors[256];
|
||||||
@@ -148,7 +164,7 @@ struct NSVGrasterizer
|
|||||||
int width, height, stride;
|
int width, height, stride;
|
||||||
};
|
};
|
||||||
|
|
||||||
NSVGrasterizer* nsvgCreateRasterizer()
|
NSVGrasterizer* nsvgCreateRasterizer(void)
|
||||||
{
|
{
|
||||||
NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer));
|
NSVGrasterizer* r = (NSVGrasterizer*)malloc(sizeof(NSVGrasterizer));
|
||||||
if (r == NULL) goto error;
|
if (r == NULL) goto error;
|
||||||
@@ -329,6 +345,7 @@ static float nsvg__normalize(float *x, float* y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static float nsvg__absf(float x) { return x < 0 ? -x : x; }
|
static float nsvg__absf(float x) { return x < 0 ? -x : x; }
|
||||||
|
static float nsvg__roundf(float x) { return (x >= 0) ? floorf(x + 0.5) : ceilf(x - 0.5); }
|
||||||
|
|
||||||
static void nsvg__flattenCubicBez(NSVGrasterizer* r,
|
static void nsvg__flattenCubicBez(NSVGrasterizer* r,
|
||||||
float x1, float y1, float x2, float y2,
|
float x1, float y1, float x2, float y2,
|
||||||
@@ -368,7 +385,7 @@ static void nsvg__flattenCubicBez(NSVGrasterizer* r,
|
|||||||
nsvg__flattenCubicBez(r, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
|
nsvg__flattenCubicBez(r, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale)
|
static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float sx, float sy)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
NSVGpath* path;
|
NSVGpath* path;
|
||||||
@@ -376,13 +393,13 @@ static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale)
|
|||||||
for (path = shape->paths; path != NULL; path = path->next) {
|
for (path = shape->paths; path != NULL; path = path->next) {
|
||||||
r->npoints = 0;
|
r->npoints = 0;
|
||||||
// Flatten path
|
// Flatten path
|
||||||
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
|
nsvg__addPathPoint(r, path->pts[0]*sx, path->pts[1]*sy, 0);
|
||||||
for (i = 0; i < path->npts-1; i += 3) {
|
for (i = 0; i < path->npts-1; i += 3) {
|
||||||
float* p = &path->pts[i*2];
|
float* p = &path->pts[i*2];
|
||||||
nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0);
|
nsvg__flattenCubicBez(r, p[0]*sx,p[1]*sy, p[2]*sx,p[3]*sy, p[4]*sx,p[5]*sy, p[6]*sx,p[7]*sy, 0, 0);
|
||||||
}
|
}
|
||||||
// Close path
|
// Close path
|
||||||
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
|
nsvg__addPathPoint(r, path->pts[0]*sx, path->pts[1]*sy, 0);
|
||||||
// Build edges
|
// Build edges
|
||||||
for (i = 0, j = r->npoints-1; i < r->npoints; j = i++)
|
for (i = 0, j = r->npoints-1; i < r->npoints; j = i++)
|
||||||
nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y);
|
nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y);
|
||||||
@@ -732,7 +749,7 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float scale)
|
static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float sx, float sy)
|
||||||
{
|
{
|
||||||
int i, j, closed;
|
int i, j, closed;
|
||||||
NSVGpath* path;
|
NSVGpath* path;
|
||||||
@@ -740,15 +757,16 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
|
|||||||
float miterLimit = shape->miterLimit;
|
float miterLimit = shape->miterLimit;
|
||||||
int lineJoin = shape->strokeLineJoin;
|
int lineJoin = shape->strokeLineJoin;
|
||||||
int lineCap = shape->strokeLineCap;
|
int lineCap = shape->strokeLineCap;
|
||||||
float lineWidth = shape->strokeWidth * scale;
|
const float sw = (sx + sy) / 2; // average scaling factor
|
||||||
|
const float lineWidth = shape->strokeWidth * sw; // FIXME (?)
|
||||||
|
|
||||||
for (path = shape->paths; path != NULL; path = path->next) {
|
for (path = shape->paths; path != NULL; path = path->next) {
|
||||||
// Flatten path
|
// Flatten path
|
||||||
r->npoints = 0;
|
r->npoints = 0;
|
||||||
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER);
|
nsvg__addPathPoint(r, path->pts[0]*sx, path->pts[1]*sy, NSVG_PT_CORNER);
|
||||||
for (i = 0; i < path->npts-1; i += 3) {
|
for (i = 0; i < path->npts-1; i += 3) {
|
||||||
float* p = &path->pts[i*2];
|
float* p = &path->pts[i*2];
|
||||||
nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, NSVG_PT_CORNER);
|
nsvg__flattenCubicBez(r, p[0]*sx,p[1]*sy, p[2]*sx,p[3]*sy, p[4]*sx,p[5]*sy, p[6]*sx,p[7]*sy, 0, NSVG_PT_CORNER);
|
||||||
}
|
}
|
||||||
if (r->npoints < 2)
|
if (r->npoints < 2)
|
||||||
continue;
|
continue;
|
||||||
@@ -794,7 +812,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
|
|||||||
dashOffset -= shape->strokeDashArray[idash];
|
dashOffset -= shape->strokeDashArray[idash];
|
||||||
idash = (idash + 1) % shape->strokeDashCount;
|
idash = (idash + 1) % shape->strokeDashCount;
|
||||||
}
|
}
|
||||||
dashLen = (shape->strokeDashArray[idash] - dashOffset) * scale;
|
dashLen = (shape->strokeDashArray[idash] - dashOffset) * sw;
|
||||||
|
|
||||||
for (j = 1; j < r->npoints2; ) {
|
for (j = 1; j < r->npoints2; ) {
|
||||||
float dx = r->points2[j].x - cur.x;
|
float dx = r->points2[j].x - cur.x;
|
||||||
@@ -816,7 +834,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
|
|||||||
// Advance dash pattern
|
// Advance dash pattern
|
||||||
dashState = !dashState;
|
dashState = !dashState;
|
||||||
idash = (idash+1) % shape->strokeDashCount;
|
idash = (idash+1) % shape->strokeDashCount;
|
||||||
dashLen = shape->strokeDashArray[idash] * scale;
|
dashLen = shape->strokeDashArray[idash] * sw;
|
||||||
// Restart
|
// Restart
|
||||||
cur.x = x;
|
cur.x = x;
|
||||||
cur.y = y;
|
cur.y = y;
|
||||||
@@ -870,10 +888,10 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta
|
|||||||
// STBTT_assert(e->y0 <= start_point);
|
// STBTT_assert(e->y0 <= start_point);
|
||||||
// round dx down to avoid going too far
|
// round dx down to avoid going too far
|
||||||
if (dxdy < 0)
|
if (dxdy < 0)
|
||||||
z->dx = (int)(-floorf(NSVG__FIX * -dxdy));
|
z->dx = (int)(-nsvg__roundf(NSVG__FIX * -dxdy));
|
||||||
else
|
else
|
||||||
z->dx = (int)floorf(NSVG__FIX * dxdy);
|
z->dx = (int)nsvg__roundf(NSVG__FIX * dxdy);
|
||||||
z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
|
z->x = (int)nsvg__roundf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
|
||||||
// z->x -= off_x * FIX;
|
// z->x -= off_x * FIX;
|
||||||
z->ey = e->y1;
|
z->ey = e->y1;
|
||||||
z->next = 0;
|
z->next = 0;
|
||||||
@@ -956,7 +974,7 @@ static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a
|
|||||||
|
|
||||||
static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
|
||||||
{
|
{
|
||||||
return (r) | (g << 8) | (b << 16) | (a << 24);
|
return ((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16) | ((unsigned int)a << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int nsvg__lerpRGBA(unsigned int c0, unsigned int c1, float u)
|
static unsigned int nsvg__lerpRGBA(unsigned int c0, unsigned int c1, float u)
|
||||||
@@ -985,7 +1003,7 @@ static inline int nsvg__div255(int x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* cover, int x, int y,
|
static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* cover, int x, int y,
|
||||||
float tx, float ty, float scale, NSVGcachedPaint* cache)
|
float tx, float ty, float sx, float sy, NSVGcachedPaint* cache)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cache->type == NSVG_PAINT_COLOR) {
|
if (cache->type == NSVG_PAINT_COLOR) {
|
||||||
@@ -1026,9 +1044,9 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
|
|||||||
int i, cr, cg, cb, ca;
|
int i, cr, cg, cb, ca;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
|
|
||||||
fx = ((float)x - tx) / scale;
|
fx = ((float)x - tx) / sx;
|
||||||
fy = ((float)y - ty) / scale;
|
fy = ((float)y - ty) / sy;
|
||||||
dx = 1.0f / scale;
|
dx = 1.0f / sx;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
int r,g,b,a,ia;
|
int r,g,b,a,ia;
|
||||||
@@ -1071,9 +1089,9 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
|
|||||||
int i, cr, cg, cb, ca;
|
int i, cr, cg, cb, ca;
|
||||||
unsigned int c;
|
unsigned int c;
|
||||||
|
|
||||||
fx = ((float)x - tx) / scale;
|
fx = ((float)x - tx) / sx;
|
||||||
fy = ((float)y - ty) / scale;
|
fy = ((float)y - ty) / sy;
|
||||||
dx = 1.0f / scale;
|
dx = 1.0f / sx;
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
int r,g,b,a,ia;
|
int r,g,b,a,ia;
|
||||||
@@ -1112,7 +1130,7 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule)
|
static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float sx, float sy, NSVGcachedPaint* cache, char fillRule)
|
||||||
{
|
{
|
||||||
NSVGactiveEdge *active = NULL;
|
NSVGactiveEdge *active = NULL;
|
||||||
int y, s;
|
int y, s;
|
||||||
@@ -1194,7 +1212,7 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
|
|||||||
if (xmin < 0) xmin = 0;
|
if (xmin < 0) xmin = 0;
|
||||||
if (xmax > r->width-1) xmax = r->width-1;
|
if (xmax > r->width-1) xmax = r->width-1;
|
||||||
if (xmin <= xmax) {
|
if (xmin <= xmax) {
|
||||||
nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, scale, cache);
|
nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, sx, sy, cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,7 +1298,7 @@ static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opac
|
|||||||
if (grad->nstops == 0) {
|
if (grad->nstops == 0) {
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
cache->colors[i] = 0;
|
cache->colors[i] = 0;
|
||||||
} if (grad->nstops == 1) {
|
} else if (grad->nstops == 1) {
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity);
|
cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity);
|
||||||
} else {
|
} else {
|
||||||
@@ -1362,8 +1380,9 @@ static void dumpEdges(NSVGrasterizer* r, const char* name)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void nsvgRasterize(NSVGrasterizer* r,
|
void nsvgRasterizeXY(NSVGrasterizer* r,
|
||||||
NSVGimage* image, float tx, float ty, float scale,
|
NSVGimage* image, float tx, float ty,
|
||||||
|
float sx, float sy,
|
||||||
unsigned char* dst, int w, int h, int stride)
|
unsigned char* dst, int w, int h, int stride)
|
||||||
{
|
{
|
||||||
NSVGshape *shape = NULL;
|
NSVGshape *shape = NULL;
|
||||||
@@ -1394,7 +1413,7 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
r->freelist = NULL;
|
r->freelist = NULL;
|
||||||
r->nedges = 0;
|
r->nedges = 0;
|
||||||
|
|
||||||
nsvg__flattenShape(r, shape, scale);
|
nsvg__flattenShape(r, shape, sx, sy);
|
||||||
|
|
||||||
// Scale and translate edges
|
// Scale and translate edges
|
||||||
for (i = 0; i < r->nedges; i++) {
|
for (i = 0; i < r->nedges; i++) {
|
||||||
@@ -1406,19 +1425,20 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rasterize edges
|
// Rasterize edges
|
||||||
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
|
if (r->nedges != 0)
|
||||||
|
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
|
||||||
|
|
||||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||||
nsvg__initPaint(&cache, &shape->fill, shape->opacity);
|
nsvg__initPaint(&cache, &shape->fill, shape->opacity);
|
||||||
|
|
||||||
nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule);
|
nsvg__rasterizeSortedEdges(r, tx,ty, sx, sy, &cache, shape->fillRule);
|
||||||
}
|
}
|
||||||
if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * scale) > 0.01f) {
|
if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * sx) > 0.01f) {
|
||||||
nsvg__resetPool(r);
|
nsvg__resetPool(r);
|
||||||
r->freelist = NULL;
|
r->freelist = NULL;
|
||||||
r->nedges = 0;
|
r->nedges = 0;
|
||||||
|
|
||||||
nsvg__flattenShapeStroke(r, shape, scale);
|
nsvg__flattenShapeStroke(r, shape, sx, sy);
|
||||||
|
|
||||||
// dumpEdges(r, "edge.svg");
|
// dumpEdges(r, "edge.svg");
|
||||||
|
|
||||||
@@ -1432,12 +1452,13 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rasterize edges
|
// Rasterize edges
|
||||||
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
|
if (r->nedges != 0)
|
||||||
|
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
|
||||||
|
|
||||||
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
// now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
|
||||||
nsvg__initPaint(&cache, &shape->stroke, shape->opacity);
|
nsvg__initPaint(&cache, &shape->stroke, shape->opacity);
|
||||||
|
|
||||||
nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO);
|
nsvg__rasterizeSortedEdges(r, tx,ty,sx, sy, &cache, NSVG_FILLRULE_NONZERO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1449,4 +1470,13 @@ void nsvgRasterize(NSVGrasterizer* r,
|
|||||||
r->stride = 0;
|
r->stride = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
void nsvgRasterize(NSVGrasterizer* r,
|
||||||
|
NSVGimage* image, float tx, float ty, float scale,
|
||||||
|
unsigned char* dst, int w, int h, int stride)
|
||||||
|
{
|
||||||
|
nsvgRasterizeXY(r,image, tx, ty, scale, scale, dst, w, h, stride);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // NANOSVGRAST_IMPLEMENTATION
|
||||||
|
|
||||||
|
#endif // NANOSVGRAST_H
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
1 VERSIONINFO
|
1 VERSIONINFO
|
||||||
FILEVERSION @SLIC3R_VERSION@
|
FILEVERSION @SLIC3R_COMMA_SEPARATED_VERSION@
|
||||||
PRODUCTVERSION @SLIC3R_VERSION@
|
PRODUCTVERSION @SLIC3R_COMMA_SEPARATED_VERSION@
|
||||||
{
|
{
|
||||||
BLOCK "StringFileInfo"
|
BLOCK "StringFileInfo"
|
||||||
{
|
{
|
||||||
@@ -8,7 +8,7 @@ PRODUCTVERSION @SLIC3R_VERSION@
|
|||||||
{
|
{
|
||||||
VALUE "CompanyName", "QIDI Technology"
|
VALUE "CompanyName", "QIDI Technology"
|
||||||
VALUE "FileDescription", "@SLIC3R_APP_NAME@"
|
VALUE "FileDescription", "@SLIC3R_APP_NAME@"
|
||||||
VALUE "FileVersion", "@SLIC3R_BUILD_ID@"
|
VALUE "FileVersion", "@SLIC3R_VERSION@"
|
||||||
VALUE "ProductName", "@SLIC3R_APP_NAME@"
|
VALUE "ProductName", "@SLIC3R_APP_NAME@"
|
||||||
VALUE "ProductVersion", "@SLIC3R_BUILD_ID@"
|
VALUE "ProductVersion", "@SLIC3R_BUILD_ID@"
|
||||||
VALUE "InternalName", "@SLIC3R_APP_NAME@"
|
VALUE "InternalName", "@SLIC3R_APP_NAME@"
|
||||||
|
|||||||
@@ -132,5 +132,10 @@
|
|||||||
<key>ASAN_OPTIONS</key>
|
<key>ASAN_OPTIONS</key>
|
||||||
<string>detect_container_overflow=0</string>
|
<string>detect_container_overflow=0</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ echo -n "[9/9] Generating Linux app..."
|
|||||||
# copy Resources
|
# copy Resources
|
||||||
cp -Rf ../resources package/resources
|
cp -Rf ../resources package/resources
|
||||||
cp -f src/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@
|
cp -f src/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@
|
||||||
|
cp -f src/*.so* package/bin/
|
||||||
# remove unneeded po from resources
|
# remove unneeded po from resources
|
||||||
## find package/resources/localization -name "*.po" -type f -delete ## FIXME: DD - do we need this?
|
## find package/resources/localization -name "*.po" -type f -delete ## FIXME: DD - do we need this?
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user