From b29b2d83cc6f3f3e090b5ffb7e81d487a03125cf Mon Sep 17 00:00:00 2001 From: Scott McCreary Date: Thu, 21 Nov 2013 06:34:00 +0000 Subject: [PATCH] Added syntax highlighting for .recipes files to Pe, work done by GCI2013 student Alvin --- haiku-apps/pe/patches/pe-2.4.3_hg611.patch3 | 217 ++++++++++++++++++++ haiku-apps/pe/pe-2.4.3_hg611.recipe | 12 +- 2 files changed, 226 insertions(+), 3 deletions(-) create mode 100644 haiku-apps/pe/patches/pe-2.4.3_hg611.patch3 diff --git a/haiku-apps/pe/patches/pe-2.4.3_hg611.patch3 b/haiku-apps/pe/patches/pe-2.4.3_hg611.patch3 new file mode 100644 index 000000000..a54f63bb2 --- /dev/null +++ b/haiku-apps/pe/patches/pe-2.4.3_hg611.patch3 @@ -0,0 +1,217 @@ +diff --git a/Languages/Resources/Jamfile b/Languages/Resources/Jamfile +index 4b19f87..7ccef27 100644 +--- a/Languages/Resources/Jamfile ++++ b/Languages/Resources/Jamfile +@@ -20,6 +20,7 @@ RezObjects + keywords.pl.r + keywords.py.r + keywords.rb.r ++ keywords.recipe.r + keywords.rez.r + keywords.sh.r + keywords.sql.r +diff --git a/Languages/Resources/keywords.recipe b/Languages/Resources/keywords.recipe +new file mode 100644 +index 0000000..7c68e3e +--- /dev/null ++++ b/Languages/Resources/keywords.recipe +@@ -0,0 +1,11 @@ ++case do done elif else esac fi for function if in select then until while cmd devel lib app add_on ++- Keyword ++BUILD_PACKAGE_ACTIVATION_FILE DISABLE_SOURCE_PACKAGE HOMEPAGE MESSAGE REVISION CHECKSUM_MD5 PATCHES SOURCE_DIR SRC_FILENAME SRC_URI ARCHITECTURES BUILD_PREREQUIRES BUILD_REQUIRES CONFLICTS COPYRIGHT DESCRIPTION FRESHENS GLOBAL_WRITABLE_FILES LICENSE PACKAGE_GROUPS PACKAGE_USERS POST_INSTALL_SCRIPTS PROVIDES REPLACES REQUIRES SUMMARY SUPPLEMENTS USER_SETTING_FILES ++- Function ++PATCH BUILD INSTALL TEST ++- Define ++addOnsDir appsDir binDir buildArchitecture configureDirArgs dataDir dataRootDir debugInfoDir developDir developDocDir developLibDir docDir documentationDir fontsDir haikuVersion includeDir infodir installDestDir isCrossRepository jobArgs jobs libDir libExecDir localStateDir manDir oldIncludeDir portBaseDir portDir portFullVersion portName portPackageLinksdir portRevision portRevisionedName portVersion portVersionedName postInstallDir preferencesDir prefix relativeAddOnsDir relativeAppsDir relativeBinDir relativeDataDir relativeDataRootDir relativeDebugInfoDir relativeDevelopDir relativeDevelopDocDir relativeDevelopLibDir relativeDocDir relativeDocumentationDir relativeFontsDir relativeIncludeDir relativeInfoDir relativeLibDir relativeLibExecDir relativeLocalStateDir relativeManDir relativeOldIncludeDir relativePostInstallDir relativePreferencesDir relativeSbinDir relativeSettingsDir relativeSharedStateDir sbinDir settingsDir sharedStateDir sourceDir targetArchitecture buildMachineTriple buildMachineTripleAsName crossSysrootDir targetMachineTriple targetMachineTripleAsName secondaryArchSuffix ++- Function ++addAppDeskbarSymlink addPreferencesDeskbarSymlink defineDebugInfoPackage extractDebugInfo fixDevelopLibDirReferences fixPkgconfig packageEntries prepareInstalledDevelLib prepareInstalledDevelLibs runConfigure ++- Type ++cmd devel lib app add_on +diff --git a/Languages/Resources/keywords.recipe.r b/Languages/Resources/keywords.recipe.r +new file mode 100644 +index 0000000..5e8410c +--- /dev/null ++++ b/Languages/Resources/keywords.recipe.r +@@ -0,0 +1,2 @@ ++read 'KeyW' (0, "keywords.recipe") ++ "keywords.recipe"; +\ No newline at end of file +diff --git a/Languages/Sources/Jamfile b/Languages/Sources/Jamfile +index 3b1a77e..ff33e31 100644 +--- a/Languages/Sources/Jamfile ++++ b/Languages/Sources/Jamfile +@@ -146,6 +146,14 @@ PeLanguage PythonExt + # + + # ++PeLanguage RecipeExt ++ : Recipe_Language.cpp ++ : be ++ : keywords.recipe.rsrc ++ ; ++# ++ ++# + PeLanguage RezExt + : Rez_Language.cpp Rez_Popup.l + : be +diff --git a/Languages/Sources/Recipe_Language.cpp b/Languages/Sources/Recipe_Language.cpp +new file mode 100644 +index 0000000..752eba8 +--- /dev/null ++++ b/Languages/Sources/Recipe_Language.cpp +@@ -0,0 +1,154 @@ ++#include "CLanguageAddOn.h" ++#include "HColorUtils.h" ++ ++_EXPORT const char kLanguageName[] = "Recipe"; ++_EXPORT const char kLanguageExtensions[] = "recipe"; ++_EXPORT const char kLanguageCommentStart[] = "#"; ++_EXPORT const char kLanguageCommentEnd[] = ""; ++_EXPORT const char kLanguageKeywordFile[] = "keywords.recipe"; ++_EXPORT const int16 kInterfaceVersion = 2; ++ ++enum { ++ START, IDENT, LCOMMENT, STRING1, STRING2 ++}; ++ ++#define GETCHAR (c = (i++ < size) ? text[i - 1] : 0) ++ ++_EXPORT void ColorLine(CLanguageProxy& proxy, int32& state) ++{ ++ const char *text = proxy.Text(); ++ int32 size = proxy.Size(); ++ int32 i = 0, s = 0, kws = 0, esc = 0; ++ char c = 0; ++ bool leave = false; ++ ++ if (state == LCOMMENT) ++ proxy.SetColor(0, kColorComment1); ++ else ++ proxy.SetColor(0, kColorText); ++ ++ if (size <= 0) ++ return; ++ ++ while (!leave) ++ { ++ char b = c; ++ GETCHAR; ++ ++ switch (state) { ++ case START: ++ if (c == '#' && (!b || isspace(b))) ++ state = LCOMMENT; ++ else if (isalpha(c) || c == '_') ++ { ++ kws = proxy.Move(c, 1); ++ state = IDENT; ++ } ++ else if (c == '"') ++ state = STRING1; ++ else if (c == '\'') ++ state = STRING2; ++ else if (c == '\n' || c == 0) ++ leave = true; ++ ++ if (leave || (state != START && s < i)) ++ { ++ proxy.SetColor(s, kColorText); ++ s = i - 1; ++ } ++ break; ++ ++ case LCOMMENT: ++ proxy.SetColor(s, kColorComment1); ++ leave = true; ++ if (text[size - 1] == '\n') ++ state = START; ++ break; ++ ++ case IDENT: ++ if (!isalnum(c) && c != '_') ++ { ++ int kwc; ++ ++ if (i >= s + 1 && (kwc = proxy.IsKeyword(kws)) != 0) ++ { ++ switch (kwc) ++ { ++ case 1: proxy.SetColor(s, kColorKeyword1); break; ++ case 2: proxy.SetColor(s, kColorUserSet1); break; ++ case 3: proxy.SetColor(s, kColorUserSet2); break; ++ case 4: proxy.SetColor(s, kColorUserSet3); break; ++ case 5: proxy.SetColor(s, kColorUserSet4); break; ++// default:ASSERT(false); ++ } ++ } ++ else ++ { ++ proxy.SetColor(s, kColorText); ++ } ++ ++ s = --i; ++ state = START; ++ } ++ else if (kws) ++ kws = proxy.Move((int)(unsigned char)c, kws); ++ break; ++ ++ case STRING1: ++ if (c == '"' && !esc) ++ { ++ proxy.SetColor(s, kColorString1); ++ s = i; ++ state = START; ++ } ++ else if (c == '\n' || c == 0) ++ { ++ if (text[i - 2] == '\\' && text[i - 3] != '\\') ++ { ++ proxy.SetColor(s, kColorString1); ++ } ++ else ++ { ++ proxy.SetColor(s, kColorText); ++ state = START; ++ } ++ ++ s = size; ++ leave = true; ++ } ++ else ++ esc = !esc && (c == '\\'); ++ break; ++ ++ case STRING2: ++ if (c == '\'' && !esc) ++ { ++ proxy.SetColor(s, kColorString1); ++ s = i; ++ state = START; ++ } ++ else if (c == '\n' || c == 0) ++ { ++ if (text[i - 2] == '\\' && text[i - 3] != '\\') ++ { ++ proxy.SetColor(s, kColorString1); ++ } ++ else ++ { ++ proxy.SetColor(s, kColorText); ++ state = START; ++ } ++ ++ s = size; ++ leave = true; ++ } ++ else ++ esc = !esc && (c == '\\'); ++ break; ++ ++ default: // error condition, gracefully leave the loop ++ leave = true; ++ break; ++ } ++ } ++} /* CshellIntf::ColorLine */ diff --git a/haiku-apps/pe/pe-2.4.3_hg611.recipe b/haiku-apps/pe/pe-2.4.3_hg611.recipe index 820b33795..22439f93f 100644 --- a/haiku-apps/pe/pe-2.4.3_hg611.recipe +++ b/haiku-apps/pe/pe-2.4.3_hg611.recipe @@ -5,10 +5,12 @@ LICENSE=" BSD (4-clause) MIT " + COPYRIGHT=" 1996-2002 Maarteen Hekkelman 2003-2013 Team Pe " + SRC_URI="hg+http://hg.berlios.de/repos/pe-editor#611" REVISION="1" ARCHITECTURES="x86_gcc2 x86 x86_64" @@ -24,10 +26,12 @@ REQUIRES=" lib:libpcre lib:libpcreposix " + BUILD_REQUIRES=" devel:libpcre >= 1 devel:libpcreposix >= 1 " + BUILD_PREREQUIRES=" haiku_devel cmd:bison @@ -43,9 +47,11 @@ USER_SETTINGS_FILES=" SOURCE_DIR="$portVersionedName" -PATCHES="pe-2.4.3_hg611.patch - pe-2.4.3_hg611.patch2" - +PATCHES=" + pe-2.4.3_hg611.patch + pe-2.4.3_hg611.patch2 + pe-2.4.3_hg611.patch3 + " BUILD() {