make your own custom keyword highlighting

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#3 Post by big_bass »

now with two colors
UPDATED code Oct-9-20011
and added a readme

BaCon in blue
HUG in green

doesnt that look so much better with color ?


remember to inclose using the forums Quote
this allows colors to be used the Code doesnt work with colors

' Imports when HUG is used as shared object
CONST HUG_lib$ = "./hug.so"

' Setup error handling
TRAP LOCAL
CATCH GOTO hug_handle_error

' Import HUG functions
IMPORT "ATTACH(long,long,int,int)" FROM HUG_lib$ TYPE void
IMPORT "BUTTON(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "CALLBACK(long,void*)" FROM HUG_lib$ TYPE void
IMPORT "CALLBACKX(long,void*,long)" FROM HUG_lib$ TYPE void
IMPORT "CANVAS(int,int)" FROM HUG_lib$ TYPE long
IMPORT "CHECK(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "CIRCLE(char*,int,int,int,int,long)" FROM HUG_lib$ TYPE void
IMPORT "CLIPBOARD" FROM HUG_lib$ TYPE long
IMPORT "COMBO(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "DISABLE(long)" FROM HUG_lib$ TYPE void
IMPORT "DISPLAY" FROM HUG_lib$ TYPE void
IMPORT "EDIT(int,int)" FROM HUG_lib$ TYPE long
IMPORT "ENABLE(long)" FROM HUG_lib$ TYPE void
IMPORT "ENTRY(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "FILEDIALOG(char*,char*,int,int,int)" FROM HUG_lib$ TYPE long
IMPORT "FOCUS(long)" FROM HUG_lib$ TYPE void
IMPORT "FONT(long,char*)" FROM HUG_lib$ TYPE void
IMPORT "FRAME(int,int)" FROM HUG_lib$ TYPE long
IMPORT "GET(long)" FROM HUG_lib$ TYPE long
IMPORT "GRAB$(long)" FROM HUG_lib$ TYPE char*
IMPORT "HIDE(long)" FROM HUG_lib$ TYPE void
IMPORT "HSEPARATOR(int)" FROM HUG_lib$ TYPE long
IMPORT "HUGOPTIONS(char*)" FROM HUG_lib$ TYPE void
IMPORT "HUGLIB$(char*)" FROM HUG_lib$ TYPE char*
IMPORT "IMAGE(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "INIT" FROM HUG_lib$ TYPE void
IMPORT "KEY" FROM HUG_lib$ TYPE long
IMPORT "LINE(char*,int,int,int,int)" FROM HUG_lib$ TYPE void
IMPORT "LIST(int,int)" FROM HUG_lib$ TYPE long
IMPORT "MARK(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "METHOD(long,int,void*)" FROM HUG_lib$ TYPE void
IMPORT "MOUSE(long)" FROM HUG_lib$ TYPE long
IMPORT "MSGDIALOG(char*,int,int,int,int)" FROM HUG_lib$ TYPE long
IMPORT "NOTEBOOK(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "OUT(char*,char*,char*,int,int)" FROM HUG_lib$ TYPE void
IMPORT "PASSWORD(int,int)" FROM HUG_lib$ TYPE long
IMPORT "PICTURE(char*,int,int,int,int)" FROM HUG_lib$ TYPE void
IMPORT "PIXEL(char*,int,int)" FROM HUG_lib$ TYPE void
IMPORT "PROGRESSBAR(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "QUIT" FROM HUG_lib$ TYPE void
IMPORT "RADIO(char*,int,int,long)" FROM HUG_lib$ TYPE long
IMPORT "REGISTER(long,int,int,int,long,long,long,long)" FROM HUG_lib$ TYPE void
IMPORT "SCREENSIZE(int)" FROM HUG_lib$ TYPE int
IMPORT "SET(long,int)" FROM HUG_lib$ TYPE void
IMPORT "SHOW(long)" FROM HUG_lib$ TYPE void
IMPORT "SPIN(int,int,double,double,double)" FROM HUG_lib$ TYPE long
IMPORT "SQUARE(char*,int,int,int,int,int)" FROM HUG_lib$ TYPE void
IMPORT "STOCK(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "SYNC" FROM HUG_lib$ TYPE void
IMPORT "TEXT(long,char*)" FROM HUG_lib$ TYPE void
IMPORT "TIMEOUT(int,void*)" FROM HUG_lib$ TYPE void
IMPORT "TOGGLE(char*,int,int)" FROM HUG_lib$ TYPE long
IMPORT "UNFOCUS(long)" FROM HUG_lib$ TYPE void
IMPORT "VSEPARATOR(int)" FROM HUG_lib$ TYPE long
IMPORT "WINDOW(char*,int,int)" FROM HUG_lib$ TYPE long

' Define the PROPERTY directive
hug_Gobject$ = HUGLIB$("gobject")
IMPORT "g_object_set(long,char*,...)" FROM hug_Gobject$ TYPE void
PROTO PROPERTY
DEF FN PROPERTY(widget, name, ...) = g_object_set(widget, name, __VA_ARGS__, NULL)

' The dialog response codes
CONST GTK_RESPONSE_ACCEPT = -3
CONST GTK_RESPONSE_DELETE_EVENT = -4
CONST GTK_RESPONSE_OK = -5
CONST GTK_RESPONSE_CANCEL = -6
CONST GTK_RESPONSE_CLOSE = -7
CONST GTK_RESPONSE_YES = -8
CONST GTK_RESPONSE_NO = -9
CONST GTK_RESPONSE_APPLY = -10
CONST GTK_RESPONSE_HELP = -11


Attachments
bacon-highlighting.tar.gz
(2.12 KiB) Downloaded 246 times
Last edited by big_bass on Mon 10 Oct 2011, 02:53, edited 2 times in total.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#4 Post by big_bass »

I updated the above post

and this is the readme to get an idea how simple it is


the folder $HOME/bacon-highlighting/ is used
$HOME on puppy is /root

1.)if you click on /root/bacon-highlighting/myparser-bacon
it will auto generate colorlist-bacon
this reads the KEYWORD2.TXT which are BaCon keywords in blue


2.)if you click on/root/bacon-highlighting/myparser-hug
it will auto generate colorlist_hug
this reads the KEYWORDS_HUG.TXT which are HUG keywords in green

*the reason this is auto generated is it allows you to modify it easily
having separate scripts allows for easy modifications and debugging
and as more colors are added this simplifies making color edits to
complex scripts

the file hug.bac was renamed to hug.bac1 just for an example file
any file could be used it is not needed for the script to work

3.)you dragNdrop hug.bac1 onto colorlist-bacon that gives the blue color
4.)you dragNdrop hug.bac1 onto colorlist_hug that gives you the green color


these files were used during testing of the color
if you need hug.bac its here ---------->http://www.basic-converter.org/hug.bac
if you need hug_imports.bac its here ----------->http://www.basic-converter.org/hug_imports.bac

Post Reply