Create  Edit  Diff  Phillro Industries  Index  Search  Changes  History  Source  RSS  Note  wikifarm  Login

phi_const_categories.rb

   1|#! ruby -Ks
   2|#-- phi_const_categories.rb
   3|#-- phi_const_categories.pi
   4|
   5|module Phi_Const_Categories
   6|
   7|# copy&paste from delphi help or source
   8|
   9|Data = <<MMMM
  10|type TAnchorKind = (akTop, akLeft, akRight, akBottom);
  11|type TAlign = (alNone, alTop, alBottom, alLeft, alRight, alClient);
  12|type TCommonAVI = (aviNone, aviFindFolder, aviFindFile, aviFindComputer, aviCopyFiles, aviCopyFile, aviRecycleFile, aviEmptyRecycle, aviDeleteFile);
  13|type TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose, bkAbort, bkRetry, bkIgnore, bkAll);
  14|TBarStyle = (bsRectangle,bsRectGradient, bsPyramid,bsInvPyramid,bsCilinder,bsEllipse,bsArrow);
  15|type TButtonStyle = (bsAutoDetect, bsWin31, bsNew);
  16|type TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, bsBDiagonal, bsCross, bsDiagCross);
  17|type TBevelShape = (bsBox, bsFrame, bsTopLine, bsBottomLine, bsLeftLine, bsRightLine, bsSpacer);
  18|type TPageScrollerButtonState = (bsNormal, bsInvisible, bsGrayed, bsDepressed, bsHot);
  19|  TFormBorderStyle = (bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow, bsSizeToolWin);
  20|type TBorderStyle = (bsNone, bsSingle, bsDouble, bsRaisedPanel, bsSunkenPanel, bsRaised3d, bsSunken3d, bsEtched, bsEmbossed);
  21|type TSEButtonStyle = (bsArrows, bsPlusMinus);
  22|type TBevelCut = (bvNone, bvLowered, bvRaised, bvSpace);
  23|  TConsistentAttribute = (caBold, caColor, caFace, caItalic, caSize, caStrikeout, caUnderline, caProtected);
  24|type THTMLCaptionAlignment = (caDefault, caTop, caBottom);
  25|  TCloseAction = (caNone, caHide, caFree, caMinimize);
  26|type TCheckBoxState = (cbUnchecked, cbChecked, cbGrayed);
  27|  TColorDialogOption = (cdFullOpen, cdPreventFullOpen, cdShowHelp, cdSolidColor, cdAnyColor);
  28|type TCustomDrawStage = (cdPrePaint, cdPostPaint, cdPreErase, cdPostErase);
  29|  TConfigModes = (cfmVirtual, cfmPersistent, cfmSession);
  30|type TColorGroup = (cgInactive, cgDisabled, cgActive);
  31|type TConnectKind = (ckRunningOrNew, ckNewInstance, ckRunningInstance, ckRemote, ckAttachToInterface);
  32|type TBevelKind = (bkNone, bkTile, bkSoft, bkFlat);
  33|type TBevelStyle = (bsLowered, bsRaised);
  34|  TConfigModes = (cfmVirtual, cfmPersistent, cfmSession);
  35|type TControlStyle = set of (csAcceptsControls, csCaptureMouse, csDesignInteractive, csClickEvents, csFramed, csSetCaption, csOpaque, csDoubleClicks, csFixedWidth, csFixedHeight, csNoDesignVisible, csReplicatable, csNoStdEvents, csDisplayDragImage, csReflector, csActionClient, csMenuEvents);
  36|type TComboBoxStyle = (csDropDown, csSimple, csDropDownList, csOwnerDrawFixed, csOwnerDrawVariable);
  37|  TComboBoxExStyleEx = (csExCaseSensitive, csExNoEditImage, csExNoEditImageIndent, csExNoSizeLimit, csExPathWordBreak);
  38|type TComponentState = set of (csLoading, csReading, csWriting, csDestroying, csDesigning, csAncestor, csUpdating, csFixups, csFreeNotification, csInline, csDesignInstance);
  39|type TControlState = set of (csLButtonDown, csClicked, csPalette, csReadingState, csAlignmentNeeded, csFocusing, csCreating, csPaintCopy, csCustomPaint, csDestroyingHandle, csDocking,);
  40|TCurrentStatus = (csStopped, csStartPending, csStopPending, csRunning, csContinuePending, csPausePending, csPaused);
  41|  TConnectionState = (csStateClosed, csStateOpen, csStateConnecting, csStateExecuting, csStateFetching, csStateDisconnecting);
  42|type TCursorType = (ctUnspecified, ctOpenForwardOnly, ctKeyset, ctDynamic, ctStatic);
  43|type TCreateType = (ctNewObject, ctFromFile, ctLinkToFile, ctFromData, ctLinkFromData);
  44|type TItemChange = (ctText, ctImage, ctState);
  45|type TClientType = (ctNonBlocking, ctBlocking);
  46|type TSQLCommandType = (ctQuery, ctTable, ctStoredProc);
  47|TColumnValue = (cvColor, cvWidth, cvFont, cvAlignment, cvReadOnly, cvTitleColor, cvTitleCaption, cvTitleAlignment, cvTitleFont, cvImeMode, cvImeName);
  48|type TDataAction = (daFail, daAbort, daRetry);
  49|type TDropDownAlign = (daLeft, daRight, daCenter);
  50|type TDataEvent = (deFieldChange, deRecordChange, deDataSetChange, deDataSetScroll, deLayoutChange, deUpdateRecord, deUpdateState, deCheckBrowseMode, dePropertyChange, deFieldListChange, deFocusControl, deConnectChange);
  51|type TDataPacketFormat = (dfBinary, dfXML, dfXMLUTF8);
  52|type TDTDateFormat = (dfShort, dfLong);
  53|  TDBGridOption = (dgEditing, dgAlwaysShowEditor, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgRowSelect, dgAlwaysShowSelection, dgConfirmDelete, dgCancelOnExit, dgMultiSelect);
  54|type TDragKind = (dkDrag, dkDock);
  55|type TDimGroup = (dgRow, dgCol, dgSum, dgPage, dgNone);
  56|  TConnectionKind = (dkSingle, dkMulti);
  57|type TDefaultMonitor = (dmDesktop, dmPrimary, dmMainForm, dmActiveForm);
  58|type TDTDateMode = (dmComboBox, dmUpDown);
  59|  TDisplayOption = (doColumnTitles, doAutoColResize, doKeyColFixed);
  60|type TDockOrientation = (doNoOrient, doHorizontal, doVertical);
  61|type TCalDayOfWeek = (dowMonday, dowTuesday, dowWednesday, dowThursday, dowFriday, dowSaturday, dowSunday, dowLocaleDefault);
  62|  TURLDownloadStatus = (dsFindingResource, dsConnecting, dsRedirecting, dsBeginDownloadData, dsDownloadingData, dsEndDownloadData, dsBeginDownloadComponents, dsInstallingComponents, dsEndDownloadComponents, dsUsingCachedCopy, dsSendingRequest, dsClassIDAvailable, dsMIMETypeAvailable, dsCacheFileNameAvailable, dsBeginSyncOperation, dsEndSyncOperation, dsBeginUploadData, dsUploadingData, dsEndUploadData, dsProtocolClassID, dsEncoding, dsVerifiedMIMETypeAvailable, dsClassInstallLocation, dsDecoding, dsLoadingMIMIHandler);
  63|type TDataSetState = (dsInactive, dsBrowse, dsEdit, dsInsert, dsSetKey, dsCalcFields, dsFilter, dsNewValue, dsOldValue, dsCurValue, dsBlockRead, dsInternalCalc, dsOpening);
  64|type TDefaultStyle = (dsWindows, dsMotif, dsMotifPlus, dsCDE, dsQtSGI, dsPlatinum, dsSystemDefault);
  65|type TCustomDrawState = set of (cdsSelected, cdsGrayed, cdsDisabled, cdsChecked, cdsFocused, cdsDefault, cdsHot, cdsMarked, cdsIndeterminate);
  66|type TDragState = (dsDragEnter, dsDragLeave, dsDragMove);
  67|type TDrawingStyle = (dsFocus, dsSelected, dsNormal, dsTransparent);
  68|type TCustomDrawState = set of (cdsSelected, cdsGrayed, cdsDisabled, cdsChecked, cdsFocused, cdsDefault, cdsHot, cdsMarked, cdsIndeterminate);
  69|type TDTCalAlignment = (dtaLeft, dtaRight);
  70|type TMPDeviceTypes = (dtAutoSelect, dtAVIVideo, dtCDAudio, dtDAT, dtDigitalVideo, dtMMMovie, dtOther, dtOverlay, dtScanner, dtSequencer, dtVCR, dtVideodisc, dtWaveAudio);
  71|type TCustomDrawTarget = (dtControl, dtItem, dtSubItem);
  72|type TDateTimeKind = (dtkDate, dtkTime);
  73|type TMPDeviceTypes = (dtAutoSelect, dtAVIVideo, dtCDAudio, dtDAT, dtDigitalVideo, dtMMMovie, dtOther, dtOverlay, dtScanner, dtSequencer, dtVCR, dtVideodisc, dtWaveAudio);
  74|type TDuplicates = (dupIgnore, dupAccept, dupError);
  75|  TEdgeBorder = (ebLeft, ebTop, ebRight, ebBottom);
  76|type TSQLCommandOption = ( eCommRowsetSize, eCommBlobSize, eCommBlockRead, eCommBlockWrite, eCommParamCount, eCommNativeHandle, eCommCursorName, eCommStoredProc, eCommSQLDialect, eCommTransactionID);
  77|type TSQLCursorOption = (eCurObjectAttrName, eCurObjectTypeName, eCurParentFieldID);
  78|type TSQLDriverOption = (eDrvBlobSize, eDrvCallBack, eDrvCallBackInfo, eDrvRestrict);
  79|type TSQLMetaDataOption = (eMetaCatalogName, eMetaSchemaName, eMetaDatabaseName, eMetaDatabaseVersion, eMetaTransactionIsoLevel, eMetaSupportsTransaction, eMetaMaxObjectNameLength, eMetaMaxColumnsInTable, eMetaMaxColumnsInSelect, eMetaMaxRowSize, eMetaMaxSQLLength, eMetaObjectQuoteChar, eMetaSQLEscapeChar, eMetaProcSupportsCursor, eMetaProcSupportsCursors,  eMetaSupportsTransactions);
  80|  TExecuteOption = (eoAsyncExecute, eoAsyncFetch, eoAsyncFetchNonBlocking, eoExecuteNoRecords);
  81|
  82|MMMM
  83|end
  84|
  85|=begin
  86|
  87|enum TCachedUpdateStatus { cusUnmodified, cusModified, cusInserted, cusDeleted, cusUninserted };
  88|type TErrorEvent = {eeGeneral, eeSend, eeReceive, eeConnect, eeDisconnect, eeAccept)};
  89|
  90|=end
  91|
  92|require "phi"
  93|
  94|# returns {const_name => [cat_name1,cat_name2,..]}
  95|#
  96|def phi_const_categories(data=Phi_Const_Categories::Data)
  97|  ret = {}
  98|  data.each{|line|
  99|    next if line.strip.empty?
 100|    case line
 101|    when /(\w*)\s*\=\s*\((.*)\)/ ,
 102|         /(\w*)\s*\=\s*set\s*of\s*\((.*)\)/
 103|      #p [:a,$1,$2]
 104|      cat = $1
 105|      names = $2
 106|      cat = cat[1..-1] if /^T[A-Z]/ =~ cat
 107|      cat = cat.intern
 108|      names = names.split(",").collect{|n|Phi.upcase(n.strip).intern}
 109|      names.each{|n|
 110|        if ret[n]
 111|          ret[n].push cat
 112|          p [:conflict,n,ret[n]]
 113|        else
 114|          ret[n]=[cat]
 115|        end
 116|      }
 117|    else
 118|      p line
 119|      raise
 120|    end
 121|  }
 122|  return ret
 123|end
 124|
 125|if __FILE__ == $0
 126|  require "Hash_tree"
 127|  puts phi_const_categories.tree
 128|end
Last modified:2004/10/28 11:55:48
Keyword(s):
References:[SupportScripts]