Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Miscellaneous libraries


  • Please log in to reply
30 replies to this topic
adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Added OutputDebug and C ahk files as well as fixes for some bugs for the previous ones.


Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Object:
  • Added new max depth feature to object_elementList()
Misc:
  • Fixed memcpy() DllCall.
C interface lib
  • Added a whack of functionality to the C interface library as well as some bug fixes.

Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
DllCallCheck:
  • Removed the need to pass A_ScriptName and A_LineNumber to the script.
  • Outputs to OutputDebug prior to popping up the dialogue.

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Oh, btw, seems that some files had gotten out of sync with my directory. Please download DllCallCheck, ClassPermisions and OutputDebug if you have them to ensure that you have the latest copy.


Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
DllCallCheck was checked in with a bug that I had fixed, but I must have checked it in before hitting the save button. Though I'm not sure how that's possible. :? Please download it again.


Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Added classes:
  • Lexer
  • StringLineReader
  • FileLineReader
Used Lexer in C.ahk parser to test its functionality and performance. Looks great so far. Will replace old parser with new one that relies on this new lexer after doing some additional tests.


Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
C.ahk
  • Can now instantiate arrays of objects, pointers to objects and arrays of pointers to objects.

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


Bamaat
  • Members
  • 6 posts
  • Last active: Dec 12 2013 05:07 PM
  • Joined: 05 Dec 2012

Adrian - thank you!

I'm designing / prototyping a context-based search algorithm and your Lexer and Object classes are very helpful.



adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012

Cool Bamaat,

 

I'll tell you though.  I did some more testing and found that it's 2.4 times the speed of the current one I have in the C.ahk.  I've found a way to just make a tokenizer which runs at 1.08 times the original, but I'm in the middle of implementing it.  It'll probably be done in a week.  I think that it might be able to become a lexer that is still faster then the 2.4x one, but more research will need to be done.

 

 

Adrian


my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Added class tokelex, which is a faster implementation of lexer. Also did some minor updates to DllCallCheck, misc, and did an implementation test of tokelex in C.


Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
I've noticed that there are ppl downloading many of my libraries, but there are no comments on them here. I was wondering why that was.

Do they work too perfectly and the docs are sufficiently that there is no need to ask questions or ask for improvements?

I would also ask anyone using these libraries to add credit to me (as I would expect anyone using anyone else's library). smile.png

Thanks all,



Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


kraker148
  • Members
  • 42 posts
  • Last active: Sep 13 2014 06:05 PM
  • Joined: 12 Mar 2009

Adrian, this library is very useful for me, especially objtree's circular reference failure is not in your library, Thanks..icon_cool.gif

but.. can we not use in your library a tree view? objtree has this propertie, but as i said, it crashes when it manipulates cylic references...icon_question.gif



adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Adrian, this library is very useful for me, especially objtree's circular reference failure is not in your library, Thanks..icon_cool.gif
 Oh, you are saying that objtree has a circular reference problem? Interesting. I've not seen objtree before, but looks like it is made by HotKeyIt. I'd suggest reporting this error.

yw btw. smile.png
but.. can we not use in your library a tree view? objtree has this propertie, but as i said, it crashes when it manipulates cylic references...icon_confused.gif:
 Yeah, this is mostly meant for debugging via a debug stream, and I don't really like doing things that have already been done. So I'd still suggest reporting the error to HotKeyIt and have him fix his bug. S/he is probably trying to build the entire tree at once instead of allowing the tree to build itself as the user opens up branches.

I'd also recommend that you be very careful with circular references as you can easily introduce a memory leak. As was suggested to me by fincs, you might want to consider storing the address instead of the object and then dereference the address when you need it. Like this:
a := {}
b := { c: a }
a.insert("d", &b)

;// b.c -> a (directly)
;// a.d -> b (indirectly via address)

bObj := Object(a.d) ;// Gets access to b object through a.d's indirect reference
Hope this helps,



Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?


kraker148
  • Members
  • 42 posts
  • Last active: Sep 13 2014 06:05 PM
  • Joined: 12 Mar 2009

Thanks for your advice and circular reference caution, it is valuable for me..

Meanwhile, I have written a class, that makes possible shown your object_listElement(..) function's text as tree. It may be not good of course, but with your suggestions...

the class is here: (it needs "objtree.ahk" library file)

c := {b:"b"}
obj := {a:c,longText:"Lorem ipsum dolor sit amet`nLorem ipsum dolor sit amet"}
c.a := obj  ;it causes to circular reference
objt := new objectTree2()
;~ MsgBox % Object_elementList(obj,"obj")

objtree(objt.doTree(obj,"obj")) ;normally, objtree cannot show obj, it crashes, but with your text it can show the obj and not crashes..

class objectTree2
{
	doTree(obj,name)
	{
		
		SetBatchLines,-1 
		txt := this.list(obj,name)
		this.text2Obj(txt,objA)
		obj2 := {}
		tmpObj := {}

		xTmp := {}
		;~ tmpParent := {}
		for k,v in objA  
		{
		  ToolTip,% "1-" A_Index
		  Loop,parse,v,<
		  {
			  levelPoints := A_LoopField 
			  
			  Level := Round(strlen(levelPoints)/2)
			  break
		  }
		  ;~ MsgBox % v "-" Level
		  
		  StringReplace,v,v,% " .",,all 
		  StringReplace,v,v,% "=",¢,all 
		  
		  objTmpX := {}
		  ;~ MsgBox % v 
		  Loop,parse,v,¢
		  {
			  objTmpX.obJ := false
			  objPlace := 0
			  
			  if (A_Index=1)
			  {
				  StringReplace,Name,A_LoopField,<
				  StringReplace,Name,Name,>
				  objTmpX.Name := Name 
			  }
			  else if (A_Index=2 )
			  {
				  objTmpX.dgr := dgr := A_LoopField
				  
			  }
			  else
				  MsgBox % A_LoopField "-delimiter ¢ is in value or what?"
			  objPlace := InStr(dgr,"Object")
			  if (objPlace=2)
			  {
				  objTmpX.obJ := true
			  }
			  objTmpX.Level := Level
		  
		  }	
		  obj2.Insert(objTmpX)
		}


		for k2,v2 in obj2 
		{
		  
		  Level := v2.Level
		  ;~ MsgBox % Level
		  ToolTip,%  "2-" A_Index
		  if v2.obJ
		  {
			  parentObj[Level] := v2.Name
		  }		
		  
		  ;~ v2.parentObj := parentObj[Level-1]
		  v2.parentObjobj := {parentObj:parentObj[(pointTotal:=Level-1)],pointTotal:pointTotal}
		}

		for k3,v3 in obj2
		{
		  if (k3=1)
		  {
			  parentObjName := v3.Name
			  parentObjName := trim(parentObjName)
			  
			  
			  tmpObj[0] := %parentObjName% := {}
			  continue
		  }
		  ;~ parentLevelTmp := v3.parentObj.nS
		  levelTmp := v3.Level
		  tmpName := trim(v3.Name)
		  tmpValue := v3.dgr 
		  if v3.obJ 
		  {
			  ;~ MsgBox % tmpName
			  if (tmpName="base")
				  tmpName:= "base__"
			  tmpObj[levelTmp] := tmpObj[levelTmp-1,tmpName] := {}
			  
			  
		  }
		  else 
		  {
			  tmpObj[levelTmp] := tmpObj[levelTmp-1,tmpName] := tmpValue

		  }
		}		
		return {info:"attention! long text values are lost!",(parentObjName):%parentObjName%}

	}
	text2Obj(txtX,ByRef n="")
	{
		n := {}
		IfInString,txtX,`r
		StringReplace,txtX,txtX,`r,,all
		StringReplace,txtX,txtX,% "`n{,`n``{",all
		loop, parse,txtX,`n
		{
			line := trim(A_LoopField)
			if (line="")
				continue
			n.Insert(A_LoopField)
		}
		return n
	}
	list(obj,name)
	{
		return Object_elementList(obj,name)
	}
	
}


adrianh
  • Members
  • 616 posts
  • Last active: Apr 07 2016 03:35 PM
  • Joined: 28 Oct 2012
Interesting, it breaks the reference, but you don't know what object is being referring to.

I think that HotKeyIt just be informed of the bug and let him/her deal with it.


Adrian

my library base
AHK_L is the bomb! With a whole lot of bug fixes, Unicode support, associative array objects, array like objects, classes and variadic functions, why wouldn't you switch?