Further improvements of text editor for POV-Ray
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 15 Jun 2017 07:34:38 +0000 (09:34 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 15 Jun 2017 07:34:38 +0000 (09:34 +0200)
*tryed "#" as preprocessor used in POV-Ray for language keywords best behaviour was to have it as a punctuation symbol
*moved "finish" to its proper category
*changed order of some POV-Ray ini files keywords to have them work better
*added a few keywords from latest pov version
*Fixed C-style closing of multiline comments (*/)

Reviewers: campbellbarton, mont29

Reviewed By: campbellbarton, mont29

Subscribers: mont29

Differential Revision: https://developer.blender.org/D2707

source/blender/editors/space_text/text_format_pov.c
source/blender/editors/space_text/text_format_pov_ini.c

index eb6877d297d029272f7471d6151378f9062e1280..0d19c50379852961d621beeb75f674e7d7a6a77f 100644 (file)
@@ -100,6 +100,7 @@ static int txtfmt_pov_find_reserved_keywords(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "adc_bailout",         len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "albedo",              len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "all_intersections",   len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "translucency",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "all",                 len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "alpha",               len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "altitude",            len)) i = len;
@@ -149,7 +150,6 @@ static int txtfmt_pov_find_reserved_keywords(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "falloff_angle",       len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "falloff",             len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "file_gamma",          len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "finish",              len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "flatness",            len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "flip",                len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "focal_point",         len)) i = len;
@@ -372,6 +372,7 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "mesh",                len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "object",              len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "ovus",                len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "lemon",               len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "parametric",          len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "plane",               len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "poly",                len)) i = len;
@@ -383,6 +384,7 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "rainbow",             len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "sky_sphere",          len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "smooth_triangle",     len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "cubic_spline",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "sphere_sweep",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "sphere",              len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "spline",              len)) i = len;
@@ -463,7 +465,12 @@ static int txtfmt_pov_find_specialvar(const char *string)
 {
        int i, len;
        /* Modifiers */
-       if      (STR_LITERAL_STARTSWITH(string, "adaptive",           len)) i = len;
+       if      (STR_LITERAL_STARTSWITH(string, "interior_texture",   len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "double_illuminate",  len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "media_interaction",  len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "media_attenuation",  len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "projected_through",  len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "noise_generator",    len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "agate_turb",         len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "bounded_by",         len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "brick_size",         len)) i = len;
@@ -481,7 +488,6 @@ static int txtfmt_pov_find_specialvar(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "cubic_wave",         len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "density_map",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "density",            len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "double_illuminate",  len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "fade_color",         len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "fade_colour",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "fade_distance",      len)) i = len;
@@ -490,7 +496,7 @@ static int txtfmt_pov_find_specialvar(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "global_lights",      len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "hollow",             len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "image_map",          len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "interior_texture",   len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "adaptive",           len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "interior",           len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "interpolate",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "inverse",            len)) i = len;
@@ -501,8 +507,6 @@ static int txtfmt_pov_find_specialvar(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "material",           len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "matrix",             len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "media",              len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "media_attenuation",  len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "media_interaction",  len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "mm_per_unit",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "mortar",             len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "no_bump_scale",      len)) i = len;
@@ -510,7 +514,6 @@ static int txtfmt_pov_find_specialvar(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "no_radiosity",       len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "no_reflection",      len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "no_shadow",          len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "noise_generator",    len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "normal_map",         len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "normal",             len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "octaves",            len)) i = len;
@@ -522,8 +525,8 @@ static int txtfmt_pov_find_specialvar(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "photons",            len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "pigment_map",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "pigment",            len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "finish",            len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "poly_wave",          len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "projected_through",  len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "quick_color",        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "quick_colour",       len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "ramp_wave",          len)) i = len;
@@ -693,9 +696,9 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
                }
                /* Handle continuations */
                else if (cont) {
-                       /* Multi-line comments */
+                       /* C-Style comments */
                        if (cont & FMT_CONT_COMMENT_C) {
-                               if (*str == ']' && *(str + 1) == ']') {
+                               if (*str == '*' && *(str + 1) == '/') {
                                        *fmt = FMT_TYPE_COMMENT; fmt++; str++;
                                        *fmt = FMT_TYPE_COMMENT;
                                        cont = FMT_CONT_NOP;
@@ -752,7 +755,7 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
                                }
                        }
                        /* Punctuation */
-                       else if ((*str != '#') && text_check_delim(*str)) {
+                       else if (text_check_delim(*str)) {
                                *fmt = FMT_TYPE_SYMBOL;
                        }
                        /* Identifiers and other text (no previous ws. or delims. so text continues) */
index 5c20a1c5f00a4de023778d8d88b10469e1b6bb76..719f4e3c036be3ea45c1c383c5d9adb8089203c8 100644 (file)
@@ -104,7 +104,11 @@ static int txtfmt_ini_find_reserved(const char *string)
         * list is from...
         * http://www.povray.org/documentation/view/3.7.0/212/
         */
-            if (STR_LITERAL_STARTSWITH(string, "clock_delta",                  len)) i = len;
+            if (STR_LITERAL_STARTSWITH(string, "Antialias_Threshold",          len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "Bounding_Method",              len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "Antialias_Gamma",              len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth",              len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "clock_delta",                  len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "clock_on",                     len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "clock",                        len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "final_clock",                  len)) i = len;
@@ -134,6 +138,7 @@ static int txtfmt_ini_find_reserved(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "Create_Ini",                   len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Display_Gamma",                len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Display",                      len)) i = len;
+       else if (STR_LITERAL_STARTSWITH(string, "Version",                      len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Pause_When_Done",              len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Verbose",                      len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Preview_Start_Size",           len)) i = len;
@@ -183,7 +188,6 @@ static int txtfmt_ini_find_reserved(const char *string)
        else if (STR_LITERAL_STARTSWITH(string, "Split_Unions",                 len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Antialias",                    len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Sampling_Method",              len)) i = len;
-       else if (STR_LITERAL_STARTSWITH(string, "Antialias_Threshold",          len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Jitter_Amount",                len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Jitter",                       len)) i = len;
        else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth",              len)) i = len;