Accéder au contenu principal

Someday, Code will speak by himself...

Some day, code will probably speak by himself, leaving coder have not choice to let himself, port himself to something else, like new cpu... It's ridiculous how 170 lines of code can easily be a Module creator for Wine...

They, may look for invalid idea left here to find-out motivation... I will recommand to inspect all C.V once again, instead spending time looking to «loisive» information possibly becoming important, it's a blog not a Code-Valley... By the way, We are so tiny here in this space, I may offer this porte-folio example for Nurun...

This example is using Wine, and parsing something that do not work as long yo read the comment and understant what is EBNF Syntax... Elsewhere, my other project, that create Python Module by inspecting AST result from module from pycparser and couples of test-module, I'm doing it over severals files inside the compilation Tree. Fixing my theory over Mozilla Firefox Generator Tree, Building it from scratch does not cost a full year of production... Maybe testing the design will, but one The AST parsing is acheived, altering string, for partability, translation or matter of category flavor, it's such information today Business are ready to pay... But major one, adaptation for top layer is the favorite one...

import os, sys, re
import iterpipes
from iterpipes import cmd, bincmd, linecmd, run, call, check_call, cmdformat, compose

import pybindgen
import ezpyinline
import pycparser 
from pycparser import c_parser as PyCParse

from classproperty import classproperty
from xml.dom import minidom
from lxml.html import parse

from lxml.cssselect import CSSSelector
from lxml import etree
from lxml.builder import E

from sets import Set
from html5lib import treebuilders

class BindGenStoreClass( ):
  BindStorage={}

  def __init__( self , BindValue=False, **Kargs ):
    print "Creating Instantiation of Class: %s" % ( self.__class__.__name__ )
    if BindValue:
      for ItemName in Kargs:
        print "\tBinding Variable %s" % ( ItemName )
        setattr( self, ItemName, Kargs[ItemName] )
  

class CodeStorage( ):

  CodeCompilePackage=[]

  def __init__( self , BindValue=False, **Kargs ):
    print "Creating Instantiation of Class: %s" % ( self.__class__.__name__ )
    if BindValue:
      for ItemName in Kargs:
        print "\tBinding Variable %s" % ( ItemName )
        setattr( self, ItemName, Kargs[ItemName] )
    

class Config( ):
  OSSourceType='Debian'
  #PackageType=r'-dev'
  #PackageName=r'wine1.2'
  IsDPKG=True
#  RegExpFileHeader={ 'h':(r'.h') }

  PackageFileList=[]
  PackageNameList=[]
  PackageNameListSelected=[]
  PackageNameMatch=[]
  PackageNameMain=None
  DictMsg={ 'error':{
    '__SearchPackageName__':("No Package %s%s installed, we strongly suggest to install a Wine package and It's development.") ,
    '__SearchPackageType__':("No Sub-Package %s%s installed, we strongly suggest to install a Wine package and It's development.") } }

  def __AptCacheLoad__( self ):
    DefName=self.__AptCacheLoad__.__name__
    self.AptCache=apt.cache.Cache()
    for ItemPackege in self.AptCache:
      self.PackageNameList.append( ItemPackege )

  def __SearchPackageName__( self ):
    DefName=self.__SearchPackageName__.__name__
    Regexp=re.compile( r'^%s' % self.PackageName )
    for ItemInspect in self.PackageNameList:
      if Regexp.match( ItemInspect.name ):
        self.PackageNameMatch.append( ItemInspect )
    if len( self.PackageNameMatch ) < 0 :
      raise StandardError, self.DictMsg['error'][DefName] % ( self.PackageName , self.PackageType )

  def __SearchPackageType__( self ):
    DefName=self.__SearchPackageType__.__name__
    Regexp=re.compile( r'%s%s' % ( self.PackageName,self.PackageType ) )
    self.PackageWine=None

    for Itempackage in self.PackageNameMatch:
      if Regexp.match( Itempackage.name ):
        self.PackageWine=Itempackage.name
        self.PackageFileList=Itempackage.installedFiles
    if self.PackageWine == None :
      raise StandardError, self.DictMsg['error'][DefName] % ( self.PackageName , self.PackageType )
    else:
      print "Found Package %s" % ( self.PackageWine )

  def __ChartFileLookup__( self ):
    for ItemRegChart in self.RegExpFileHeader.keys():
      StrValueEnd=self.RegExpFileHeader[ItemRegChart]
      for ItemFile in self.PackageFileList:
        if ItemFile.endswith( StrValueEnd ):
          self.PackageNameListSelected.append( ItemFile )
          
  def __init__( self, BindValue=True, **Kargs ):
    print "Creating Instantiation of Class: %s" % ( self.__class__.__name__ )
    if BindValue:
      for Item in Kargs:
        print "\tBinding Variable %s" % ( Item )
        setattr( self,  Item , Kargs[Item] )
        
    import apt
    self.__AptCacheLoad__()
    self.__SearchPackageName__()
    self.__SearchPackageType__()
    self.__ChartFileLookup__()
    

class WineDefAccessor( Config ):

  __all__=[ ]
  RegExpFilter='(?iu)'
  DictUserLevelProtection={ 'UserLevel':[ r'%suser'   % RegExpFilter ] ,
                            'Password':[ r'%spasword' % RegExpFilter ,
                                         r'%spasswd'  % RegExpFilter ,
                                         r'%spwd'     % RegExpFilter ,
                                         r'%spass'    % RegExpFilter ] }
  DictReference=dict()

  def __UserLevelRestriction__( self , StrArgKey , KeyNameInspections, DefaultDisplayOnConfidential='<<UserConfidential>>' ):
    IntSetUserConfidential=False

    NamedItem=None
    for ItemRestriction in self.DictUserLevelProtection.keys():
      for ItemList in self.DictUserLevelProtection[ItemRestriction]:
        TestRegExp=re.compile( ItemList )
        if TestRegExp.match( KeyNameInspections ) :
          IntSetUserConfidential = True

      if not IntSetUserConfidential:
        NamedItem=StrArgKey
      else:
        NamedItem=DefaultDisplayOnConfidential
    return NamedItem

  def __KargsTransfert__( self, **kargs ):
    for ItemKey in kargs:
      setattr( self, ItemKey , kargs[ItemKey] )

  def __init__( self, BindModule=False, **kargs ):
    if BindModule :
        self.__KargsTransfert__( **kargs )
    self.CodeParsing()

  def CodeParsing( self ):
    self.CodeBinderClass.BindStorage['module']=dict()
    if self.Conf.PackageWine != None:
      print "Start Parsing Include Header in package %s" % ( self.Conf.PackageWine )
      for FileNameHeader in self.Conf.PackageNameListSelected:
        print "Parsing File: %s" % FileNameHeader
        StrFileBuffer=""

        FileHandler=open( FileNameHeader, 'r+' )
        ### There is some regulation, inside file we need to add,
        ### Assuming it's /usr/include/wine/windows/ddk/compstui.h with wine version 1.2
        ### There's some Yaml rule to define to let the AST work... Or, some may implement 
        ### PyBoost.Spirit, has AST-finite parser, using Plain EBNF syntax from 

        ### http://userweb.cs.utexas.edu/users/lavender/courses/c++/ansic.g, and Using SimpleParser
        ### and you can acheive, fast, efficient AST-Rules stored in the CStore.CodeCompilePackage
        ### And Using next Step...
        ###
        ###
        ###

        StrNameModuleFromFile=FileNameHeader.split('/')
        StrNameModuleFromFile=StrNameModuleFromFile[len(StrNameModuleFromFile)-1]
        StrNameModuleFromFile.replace( '.h', '' )
        StrQualifiedName='%s_%s' % ( self.Conf.PackageNameMain , StrNameModuleFromFile )
        self.CodeBinderClass.BindStorage['module'][StrQualifiedName]=dict()
        self.CodeBinderClass.BindStorage['module'][StrQualifiedName]['Module']=pybindgen.Module( StrQualifiedName )
        self.CodeBinderClass.BindStorage['module'][StrQualifiedName]['Include']=self.CodeBinderClass.BindStorage['module'][StrQualifiedName]['Module'].add_include('"%s"' % FileNameHeader )

        #self.CStore.CodeCompilePackage.append( self.CCodeParser.parse( FileHandler.read() , FileNameHeader ) )

        FileHandler.close()
      
  def SearchWithRegExp( self, RegExpr, Buffer , MethodExtract='yield' , RegExpMeth='findall' ):
    StdGetattrList=[ 'print']
    StdGetattrListException=[ 'yield' ]
    if hasattr( RegExpr, RegExpMeth ):
      for IterFinder in getattr( RegExpr, RegExpMeth)( Buffer ) :
        if MethodExtract in StdGetattrList:
          getattr( __builtins__, MethodExtract )( str(IterFinder).replace( '\'', '' ) )
        if MethodExtract in StdGetattrListException:
          yield str(IterFinder).replace( '\'', '' )
      if MethodExtract == 'yield':
        raise GeneratorExit, 'Function Name %s had no other Generated Item' % ( self.SearchWithRegExp.func_name )

  def NodeLXml( self, StrType, *args):
    return { StrType:' '.join(args)}
  
  def StartNewTask( self, TypeFuncName, TupleData ):
    if hasattr( self, 'ThreadStart' ):
      self.ThreadStart.start_new( TypeFuncName, TupleData )
    else:
      import thread
      setattr( self, 'ThreadStart', 'None' )
      self.ThreadStart=thread()
      self.ThreadStart.start_new( TypeFuncName, TupleData )
      raise Warning, "Try to load the thread module from object %s instanciation like VarName=%s( ThreadStart=thread )" % ( self.__class__.__name__ , self.__class__.__name__ )




if __name__ == '__main__':
  del WineModParser
  WineModParser=WineDefAccessor( True,
                                 Conf=Config(True,PackageNameMain='wine' , PackageType=r'-dev', PackageName=r'wine1.2', RegExpFileHeader={ 'h':(r'.h') } ),
                                 CStore=CodeStorage(),
                                 CodeBinderClass=BindGenStoreClass(),
                                 CCodeParser=PyCParse.CParser() )




XCode under Essay, or simple example
XText may contains errors, syntax errors or lexical error...
  • 1No Interest
  • 2Somewhat good
  • 3Good
  • 4Special.

Posts les plus consultés de ce blog

I am developper and Network Administrator and I respond to does Won’t Teach to theirs Kids to Code.

 And not yet music composer. But I made A.T.R. with Netracker in the 1990, and i am satisfied to say it's also programming while as simple reality to result it's whats sound producing from this MIDI translation of music sample into note. It's not because it take 20 years to achieve another part of a dream consist to understand code being sound plugin where some L.A.D.S.P.A. teach me howto drive the information and eventually re-create the plugin that turn the electricity down but from plugins activity. But I can say, my case involving having and partner that did the homework job in database to complete code where in a script alike Perl and I did learn from my same example I am showing online and about to expose because the first part is done. In fact it's having the plenty design and the code for 25 year in head since I did this homework in 1999-2000. The worst, I can give demonstration of a complex problem in users need, to have a system that does everything, and some ...

OpenAI devrait porter le nom de "OpenCrate with Rust" surtout si c'est le projet d'un GrandPère de l'AI qui gage sur IDF slint.

  Crate Cargo Rust...  À ma découverte de vouloir, ne par utilisé un MacIntosh, un Apple ou une paire de lunette de Apple pour voir foirer en beauté Rust avec son CARGO de "CRATE", et surtout de n'avoir pas réussi à laisser le "Rust Playground" ouvert plus de 5 minutes sur ma machine en Firefox et voir l'interface planter après avoir testé un projet de "base64", celle d'affiché un menu en mode texte.  IDF tient de l'acronyme ( Intel Developpers Framework ). Et personnellement voir un projet Rust tenir avec des clamps( appelé mitaine dans mon cas ) avec IDF reste un jeu d'équilibre. Facile à briser et relate des thèses et des manipulations qui demandent apparemment d'augmenter l'index mémoire, de la pile si vôtre projet slint plante une fois sur vôtre puce esp32s3.    Côté Arduino  À ma découverte j'ai installé IDF 5.1.5 qui est proche du développement Arduino esp32 (version 3.0.5 et utilise IDF 5.1.33-d... ). Et oui suite à ...

Hottest Snapshoot from my ThF4_LaFe Hard-State Nuclear Holdrum

This is my ThF 4 + LaFe (α-Fe) Nuclear Holdrum ( more than quantic-one ), for it's hard-state design. It's the revealed reproduction from 1980, after seeing the images with my tiny eyes from M.Villeneuve having a snapshoot from the Psychiatric hives, or vault. It was forbidden to stole because it was not yet made at this moment... To reproduce the image on the picture, they use white paint on the Xenon tube on external side of the holdrum... In fact this is PTFE thread used and it have it's property... Ionisation from PTFE thread is mildly-helper driving photo-source like filter-to-filter of a « ridicule » quater-plate effect side of using Fluor in light filtering, while in high-energy and high velocity light it en-lighting prior to filter... In This case  it's good, we are dealing with Ultra-violet led PaInSe ( also know as Hard-state gamma-ray pulse led from Praseodymium/Indium with filter to throw down wavelength to UV region...   ). I can conclude it's 5 xeno...